Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
post中的Wordpress javascript_Javascript_Wordpress - Fatal编程技术网

post中的Wordpress javascript

post中的Wordpress javascript,javascript,wordpress,Javascript,Wordpress,我如何不通过不呈现标记内部的内容来实现核心中应该包含的非常简单的功能 <code> <script type="text/javascript"> alert('WHY ARE YOU PARSING THIS'); </script> </code> This is parsed by wordpress. 警报('为什么要解析此'); 这是由wordpress解析的。 要分析此项,请单击“确定”: <script type=

我如何不通过不呈现
标记内部的内容来实现核心中应该包含的非常简单的功能

<code>
<script type="text/javascript"> alert('WHY ARE YOU PARSING THIS'); </script>
</code> 

This is parsed by wordpress.

警报('为什么要解析此');
这是由wordpress解析的。

要分析此项,请单击“确定”:

<script type="text/javascript"> alert('yea parse this please'); </script> 
alert('yea parse this please');
您可以在
functions.php
文件中添加过滤器来应用内容:

add_filter('the_content', function($content){
    return preg_replace_callback('~<code>([\s\S]*?)</code>~', function($matches){
        return sprintf('<code>%s</code>', esc_html($matches[1]));
    }, $content);
});

你可能还想在最简单的解决方案中找到答案:逃离
@sirko中的东西,然后我会得到
<script>
,这很难读懂