对不起我的英语,我不是母语人士 .
到目前为止,我一直试图解决这个问题几个小时没有运气 . 这个问题看起来像是之前在Stack Overflow上提出的问题的重复,但这里找到的解决方案都不适用于我 .
TinyMCE包装你在p标签内放置的任何东西 . 我需要更改tinymce的forced_root_block设置以防止这种情况,但我不知道如何在Wordpress上实现这一点 .
我尝试将代码here放在我的functions.php中,但它没有用 . 此外,问题不仅仅是一个TinyMCE问题:它将p标记作为默认行为,因为它需要一个根块 . 在我的情况下,我没有't need a root block, because the editor'的内容只是一个纯文本,其根块在我的模板的代码中 . 添加的p标签只会破坏我的布局,放置不必要的html元素 .
我尝试使用TinyMCE advaced插件,它有这个选项:
Stop removing the <p> and
tags when saving and show them in the Text editor
但是当没有检查时,会产生“剥离”所有p标签的效果,甚至是我在编辑器中有意使用的标签 .
我想要实现的只是 prevent the editor from adding unwanted p tags ,同时 keep the p tags I intentionally use .
有没有办法在Wordpress上编辑TinyMCE的forced_root_block设置?
2 回答
你可以尝试设置
您可以查看此wordpress plugin以更改此设置 . 这是另一种可能性:http://wpengineer.com/1963/customize-wordpress-wysiwyg-editor/
编辑:经过太多时间我在同时处理的两个不同的Wordpress安装之间搞乱了 . 链接帖子的解决方案对我有用,但我正在检查其他网站上的结果 . 把这个:
在我的functions.php中,TinyMCE停止在p标签内放置任何内容 . 需要检查TinyMCE Advaced的
Stop removing the <p> and
.tags when saving and show them in the Text editor