How to Remove the Unwanted p Tag that Wordpress Adds?

Wordpress has this annoying habit of adding <p> tags to your post. Most of the times you don’t care, but sometimes it breaks your HTML and makes it non-compliant with W3C. Some have written a component just to handle this, the solution is very simple:

If you want to remove the <p> tag that is added automatically, then all you need to do is to edit the file default-filters.php in the wp-includes directory. Search for this line:

add_filter(’the_content’, ‘wpautop’);

and comment it out by adding // in the start of the line (sorry I have to explain this for non-programmers), so ultimately the line will be:

//add_filter(’the_content’, ‘wpautop’);

Save the file and upload it. There you go, no more of these annoying <p> tags!

This method has one disadvantage, is that when you upgrade Wordpress you have to redo the above, still, it can take you only 1 minute.


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply