Wordpress javascript in post -
how not accomplish very functionality should of been included in core not rendering inside of <code></code>
tags.
<code> <script type="text/javascript"> alert('why parsing this'); </script> </code> parsed wordpress.
ok parse this:
<script type="text/javascript"> alert('yea parse please'); </script>
you apply esc_html content adding filter in functions.php
file:
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); });
Comments
Post a Comment