How do I make script load after jquery?

You have a typo in your code. It should be:

function load_my_script(){
    wp_register_script( 
        'my_script', 
        get_template_directory_uri() . '/js/myscript.js', 
        array( 'jquery' )
    );
    wp_enqueue_script( 'my_script' );
}
add_action('wp_enqueue_scripts', 'load_my_script');

The jQuery dependency needs to be an array(), not just a string. This will force your script to load after jQuery.

Leave a Comment