views:

185

answers:

3

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?

A: 

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

$html_code = preg_replace('/<\/?p>/','', $html_code);
cypher
Thanks I will test it.
Ozzy
That'll remove ALL `<p>` tags, not just the ones from WordPress.
ceejayoz
Yes, i'm assuming that this comes from some wysiwyg editor in Wordpress, so we're actually removing all of those <p>s.
cypher
A: 

The WP Unformatted module will remove that default filter.

ceejayoz
here is a newer version that is compatible up to 2.9.2 http://wordpress.org/extend/plugins/remove-wordpress-autop-filter/
Kasumi
+3  A: 

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

remove_filter('the_content', 'wpautop');
gasoved