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>
,这很难读懂