I am used to of adding javascript/jquery code in posts via visual editor but it seems I never used && operator cause wordpress is altering && operator in &. Here is a link where I am using &&. http://demo.techstriders.com/corey/canyon/calculator/ I am wondering what is correct way of using javascript in wordpress visual editor.
You should use wp_enqueue_script for your javascript files instead of adding the code directly into the post content.
ps:
You can check out the callbacks on the the_content
filter, using
add_action('wp_footer',function(){
global $wp_filter;
printf('<pre>%s</pre>',print_r( $wp_filter['the_content'],true));
});
to display them in the footer part of your theme. Then you will see callbacks like
wpautop
, wptexturize
, convert_chars
and convert_smilies
.
I don't recommend it, but it is possible to remove these filters to use javascript code in the post content:
add_action('init','custom_init');
function custom_init() {
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');
remove_filter('the_content', 'convert_chars');
remove_filter('the_content', 'convert_smilies');
}