html'<'和'>'会消失

时间:2013-03-31 10:41:28

标签: wordpress

我已经在我的ChildTheme functions.php中复制了以下代码,但它还没有工作:

remove_action('init', 'kses_init');
remove_action('set_current_user', 'kses_init');

1当我在HTML MODE中编写一些代码时,例如:

<pre>
<div>why the DIV outside will disappear? </div>
hello() => 'hello world';   //The '>' will disappear as well
</pre>

2但是把它改成WRITE MODE,它不是我所期望的,回到HTML MODE,它继续这样:

<div>why the DIV outside will disappear?</div>
<pre>hello() =&gt; 'hello world';   //The '&gt;' will disappear as well
</pre>

3当我预览帖子时,页面显示如下(&gt;更改为&amp; gt; ):

为什么外面的DIV会消失?

hello() =&gt; 'hello world';   //The '&gt;' will disappear as well

现在我想知道它是否由插件WP Code Highlight引起。

1 个答案:

答案 0 :(得分:0)

你需要html编码html实体。在php中,您可以使用函数htmlentities()

基本上<>是控件字符,需要<{1}}和&lt; 转义&gt;符号也需要替换为&