Hey everybody I want to let you know that I have undertaken the grueling task of getting the heck away from WordPress. I was so sick of the problems and updates I had to do all the time. I am now using my ezbloo system and I am integrating all my old posts into the new system. It sucks, but in the end, I will save bundles of time. I needed to keep things simple and that is why I created ezbloo. I'll have more on this later for you guys after I am done with the total integration of my old posts here. So if you are looking for a post and need it faster, shoot me an email and I will make it a priority. [email protected]

If you are dealing with empty tags in WordPress you have come to the right place. I have a very simple solution for you to carry out. Thanks to CSS3 we have a selector that will look for anything that is empty in your website and put a "display:none" commend to those empty tags.

Dealing With Empty Tags In WordPress that are Paragraphs

WordPress by default creates a paragraph tag on everything. So as soon as you start writing your post or page WordPress will dynamically add
<p>
to everything with a closing
</p>
tag. However if you have ever been in your editor in your dashboard and writing you will sometimes hit the return or enter button a couple of times to give it some space. This is not the way to handle new paragraphs or spacing in WordPress. The real problem comes in when you try to go to text view and see the extra "p" tags but you cannot see them because WordPress hides the "p" tags.

Empty "p" Tags

You could have several empty "p" tags that you are not aware of. If you have blogged for quite sometime you more than likely have thousands of empty p tags that you are not aware of. I know that I have had several empty "p" tags in our WordPress here at a1websitepro but we were able to remedy that problem with the solution below.

How to deal with Empty "p" tags In WordPress

  1. Install a custom CSS plugin OR,
  2. Edit your child theme style sheet.
    1. Go to Appearance
    2. Themes
    3. Edit Stylesheet
  3. Then you want to put this code in the bottom of the style sheet.
p:empty {
    display: none;
    }

Dealing With All Empty Tags in WordPress

So this method does good when you want to take care of all the empty paragraph tags but what about other empty tags? There are image tags, heading tags and more. There is a solution for this as well in CSS. If you want to make sure that there are NO empty tags in your WordPress CMS us the code below. This will get rid of all empty tags on your website. You can use this code in any website or any CMS to deal with the empty tags.

Drawback to using this code for all Empty Tags

One of the drawbacks for using this code for all empty tags is the fact that form items with empty elements will not be shown. So if you have a contact form with an input type that has no value this code will remove it altogether.
*:empty {
    display: none;
    }

SEO AND DEALING WITH EMPTY TAGS IN WORDPRESS

Will empty tags affect the SEO on your website? Probably because of the fact that search engine spiders often look for proper punctuation, heading tags and more to decide the worthiness of your website. If you have a bunch of empty tags lying around you will probably suffer the consequences of having them there. Use the real estate on your website wisely. Sometimes space is good but you should handle it with the style sheet and not empty "p" tags.