Processing javascript on wordpress

The script tags are only there to contain the JavaScript that will be executed by the browser. You need to tell WordPress to ignore those tags so it doesn’t process them as HTML. One way to do this is to use the “esc_html” function. You’ll need to wrap the script tags in the following code:

<?php echo esc_html( '<script type="text/javascript">' . $script . '</script

tech