脚本宝典收集整理的这篇文章主要介绍了php – 停止WordPress自动显示标签,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
PReg_replace(array('<p>','</p>'),array('',''),the_content(),1); remove_filter( 'the_content','wpautop' ); preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU','\1\2\3',$content)
您可以尝试从the_excerpt或the_content中删除过滤器wpautop
remove_filter( 'the_content','wpautop' ); // OR remove_filter( 'the_excerpt','wpautop' );
有时它不起作用(过去不适合我.不是PHP).
您可以尝试使用Javascript / jquery,在加载DOM之后或关闭之前放置此代码< / body>标签.
jQuery('p:empty').remove();
将删除所有空的< p>< / p>来自整个文档的元素.
以上是脚本宝典为你收集整理的php – 停止WordPress自动显示标签全部内容,希望文章能够帮你解决php – 停止WordPress自动显示标签所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。