Empty <p> tags not in my code show up in wp

Hello all.
was wondering how do I get rid of these tags?
I didn’t put them in my code. This happens also after i placed the text in notepad to strip it of any possible coding.
I think it is causing problems in validator and it is adding extra spaces when not needed in my layouts.


Its probably from the Wordpress function that sets the text spacing, new lines etc. It replaces (or augments) the PHP function nl2br but uses paragraphs to keep the formatting you type in.

I wouldn’t worry about them to be honest, if you see the function you will understand why!

well. it is throwing off the padding and margins in the layout.
I’d love to know how to get rid of it.

It might be the editor you’re using. AFAIK the WYSIWYG is the one that adds p tags, the other doesn’t.

well i just used the wp section to create the pages
even used notpad to strip it of possible code before i pasted it in.

Also I keep getting this in validator

Error Line 184, Column 4: No p element in scope but a p end tag seen.


I am thinking it is tied to that.

My offhand guess would be that you have some returns in your text editor that WP is automatically turning into empty <p> tags. See if it fixes things to delete anything after the final word. (I see clients entering content with extra returns like this all the time, and it drives me nuts.)

Wordpress is buggy with its auto formatting and especially with its insertion of <p> tags. I had to go so far as to disable auto <p> tags by using a plugin. Instead of <p> tags I have faux paragraphs using <br> tags. It is not what I would prefer but it is better than the buggy paragraph tags appearing where you don’t want them and screwing up everything. I found the problem worst when using certain HTML tags like <code>.


Hi Cheesedude, thank you for the advice. Will look into that plugin.