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

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -