Ozzy
Ozzy

Reputation: 905

How to remove extra <p> in WordPress?

I'm new to wordpress and currently developing a theme on it. I have noticed that Wordpress adds <p> tags all over the page. Do you know any plugin or a workaround to avoid this?

Upvotes: 4

Views: 7997

Answers (3)

gasoved
gasoved

Reputation: 346

Add this to your functions.php, this should give the result you're looking for:

remove_filter('the_content', 'wpautop');

Upvotes: 15

ceejayoz
ceejayoz

Reputation: 180024

The WP Unformatted module will remove that default filter.

Upvotes: 0

cypher
cypher

Reputation: 6992

Try this, assuming you have the html code in variable $html_code

$html_code = preg_replace('/<\/?p>/','', $html_code);

Upvotes: 1

Related Questions