简体   繁体   中英

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?

将此添加到您的functions.php中 ,这应该给出您正在寻找的结果:

remove_filter('the_content', 'wpautop');

试试这个,假设你在变量$html_code有html代码

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

WP Unformatted模块将删除该默认过滤器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM