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?
views:
185answers:
3
A:
Try this, assuming you have the html code in variable $html_code
$html_code = preg_replace('/<\/?p>/','', $html_code);
cypher
2010-06-21 15:34:57
Thanks I will test it.
Ozzy
2010-06-21 15:37:58
That'll remove ALL `<p>` tags, not just the ones from WordPress.
ceejayoz
2010-06-21 15:49:46
Yes, i'm assuming that this comes from some wysiwyg editor in Wordpress, so we're actually removing all of those <p>s.
cypher
2010-06-21 16:04:29
here is a newer version that is compatible up to 2.9.2 http://wordpress.org/extend/plugins/remove-wordpress-autop-filter/
Kasumi
2010-06-21 16:03:19
+3
A:
Add this to your functions.php, this should give the result you're looking for:
remove_filter('the_content', 'wpautop');
gasoved
2010-06-23 01:11:26