What is the definitive best practice for using JavaScript in WordPress posts, aside from creating an infinite number of Templates?
Placing it in the HTML tab causes a slew of problems for me, because of the p and br tags WordPress insists on inserting. Anyone else run into this problem?
Thank you in advance!
Strip out the white space and returns in your JS and it will work. That won’t give the WP editor anything to add breaks and returns to.
Or, throw this in functions.php:
and then bracket your JS in the editor like this: