开发者

How to remove extra <p> in WordPress?

开发者 https://www.devze.com 2023-01-04 09:48 出处:网络
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 p开发者_JS百科lugin or a workaround to avoid this?Add

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 p开发者_JS百科lugin or a workaround to avoid this?


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

remove_filter('the_content', 'wpautop');


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

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


The WP Unformatted module will remove that default filter.

0

精彩评论

暂无评论...
验证码 换一张
取 消