How to remove extra

in WordPress?

2019-04-09 16:17发布

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?

3条回答
可以哭但决不认输i
2楼-- · 2019-04-09 16:39

The WP Unformatted module will remove that default filter.

查看更多
迷人小祖宗
3楼-- · 2019-04-09 16:41

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

remove_filter('the_content', 'wpautop');
查看更多
beautiful°
4楼-- · 2019-04-09 16:51

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

$html_code = preg_replace('/<\/?p>/','', $html_code);
查看更多
登录 后发表回答