Make jQuery library load before plugin files

If you look at the wp_enqueue_script Codex Documentation, you’ll see one of the options is $deps, this would mean that your script is dependent upon another script, simply add jquery as a dependancy and your scripts will load in the correct place.

If you set a handle for the other scripts you can use them as a dependent as well.

Example:

wp_enqueue_script( 
    'your-handle', 
    get_bloginfo('template_url') . '/path/script.js', 
    array( 'jquery' ) 
);

Leave a Comment