• I have a piece of JS code I want to run within a post, but all the quotes — single or double — get converted into escape codes and the code doesn’t run. What can I use that won’t get converted so the code will run?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You could try taking out the “wp-texturize” filter in /wp-includes/vars.php. it’s at the very bottom of that file, just comment it out like this:
    //add_filter(‘the_content’, ‘wptexturize’);
    I’m not sure if that is going to do it for you though. What’s the JS you want to run?
    Also any “texturize” or other plugins might be doing that as well.

    Thread Starter scottallen

    (@scottallen)

    I have a couple of pieces of code I want to run. One is the Amazon affiliate code where it’s hosted on their site. Another is some code that displays photos of members from another site who are online right now. Pretty hard to run any Javascript code without any quote marks. Also, if I remove that filter, that will impact all my other posts. I’d like to just be able to shut it off for one post, or to have some input character that would produce the correct output characters so I could make the code execute.

    Are you sure it will impact your other posts that much. I find it does more harm than good. I use the “markdown” plugin and disable the wp-texturize, and it works great for me. You should try it and see.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I run Javascript within a post?’ is closed to new replies.