问题描述
我不知道是否是 wordpress 本身或微小的 MCE 这样做。但是在 HTML 和 Visual 编辑器之间切换时,它会添加 ,并且每次我来回切换时添加一个。我甚至没有代码中的换行符,似乎在某种程度上决定在何处根据我的 html 代码中的标签来放置它们。
是什么原因造成的,我该如何解决?
我已经在模板函数文件中尝试了这个:
//disable auto p
remove_filter ('the_content', 'wpautop');
remove_filter ('comment_text', 'wpautop');
// Remove auto formatting
remove_filter('the_content', 'wptexturize');
remove_filter('comment_text', 'wptexturize');
remove_filter('the_title', 'wptexturize');
最佳解决方案
所有我使用的是 remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' );,并阻止 Wordpress 创建任何额外的标记。您是否从外部编辑器复制和粘贴代码?
参考文献
注:本文内容整合自 Google/Baidu/Bing 辅助翻译的英文资料结果。如果您对结果不满意,可以加入我们改善翻译效果:薇晓朵技术论坛。