Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Following How to add a javascript snippet to the footer that requires jQuery I am trying to load jQuery before my script does stuff but it's not working.

This is it working when I include jQuery manually

This is it not working when I do it the right way.

In that previous question, the answerer says I should put my script material inside an if( wp_script_is( 'jquery', 'done' ) ) {, and I tried that too but the part within the if never gets executed.

share|improve this question
Why not just hook everything to wp_enqueue_scripts and put it in separate javascript files if you're just going to wrap it in jQuery(document).ready(function($).. anyway? –  Andrew Bartel May 31 '13 at 17:11
Do you see jQuery in source at all when queueing? Also you should be using wp_enqueue_scripts hook rather than more generic wp_head. –  Rarst May 31 '13 at 17:14
@Rarst TRhank you!! I saw that it loads after my code.. I should put wp_enqueue_script( 'jquery' ); outside of myscript_jquery() function. It's working now. :) –  laggingreflex May 31 '13 at 17:40
@AndrewBartel Part of my script has to be dynamically made, using variables from my plugin. (I'm looking into how to achieve my goal without that, but this is still a valid approach, no?) –  laggingreflex May 31 '13 at 17:40
use wp_localize_script to pass data from php to javascript, no need to print it directly to the page yourself. –  Milo May 31 '13 at 18:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.