删除 <p>和<br/>WordPress 帖子中的标签 [英] Removing <p> and <br/> tags in WordPress posts

查看:25
本文介绍了删除 <p>和<br/>WordPress 帖子中的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我在 WordPress 帖子页面上发布一些内容时,它都会显示一些段落标签,例如


.这在输出中显示了一些额外的空间.那么有什么解决办法吗?如何删除所有标签?

Whenever I am posting some content in WordPress post page it is showing some paragraph tags like <p> and <br/>. Which is showing some extra space in output. So is there any solution for it? How to remove all the tags?

推荐答案

发生这种情况是因为 WordPress 的 wpautop.只需在主题的functions.php 文件中添加以下代码行

This happens because of WordPress's wpautop. Simply add below line of code in your theme's functions.php file

remove_filter('the_content', 'wpautop');

remove_filter('the_excerpt', 'wpautop');

更多信息:http://codex.wordpress.org/Function_Reference/wpautop

这篇关于删除 &lt;p&gt;和&lt;br/&gt;WordPress 帖子中的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆