默认情况下,WordPress 会自动为分类描述添加段落标签<p>,比如:
echo category_description();
会自动输出:文章源自知更鸟-https://zmingcx.com/remove-p-tags-category-description.html
<p>我的分类描述</ p>
当主题调用分类描述时,这个段落标签很碍事,完全没必要。文章源自知更鸟-https://zmingcx.com/remove-p-tags-category-description.html
将下面代码添加加到主题函数模板functions.php中,移除段落标签。文章源自知更鸟-https://zmingcx.com/remove-p-tags-category-description.html
remove_filter ('term_description', 'wpautop');文章源自知更鸟-https://zmingcx.com/remove-p-tags-category-description.html文章源自知更鸟-https://zmingcx.com/remove-p-tags-category-description.html
本站文章大部分始于原创,用于个人学习记录,可能对您有所帮助,仅供参考!

我的微信
版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!
评论