I'm working on a custom theme in which it uses a custom script loaded like so in the functions.php file:

function custom_scripts_method()
        wp_register_script('custom_script', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0.0', true);

add_action('wp_enqueue_scripts', 'custom_scripts_method');

I need jQuery to get it to run properly, I tried to enqueue the already existing jQuery with:

function theme_scripts() {
add_action('wp_enqueue_scripts', 'theme_scripts');

As answered in this question here: Is jQuery included in WordPress by default?

However, this does nothing. So I added my own jQuery like so:

function jquery_scripts_method()
        wp_register_script('jquery_script', get_template_directory_uri() . '/js/jquery.min.js', array('jquery'), '3.3.1', true);

add_action('wp_enqueue_scripts', 'jquery_scripts_method');

That worked, but then it also loaded the already existing jQuery along with it. So now there are two files being called, version 1.12 and 3.3.

How do I just get the one that is already there to load?

1 Answer 1


The first block of code, from your question, is all you need. 'jquery' is specified in wp_register_script function call as dependency. When you enqueue your 'custom_script', 'jquery' will be enqueued also.

  • In the first block of code, it a custom script, not jquery.
    – Xarcell
    Jan 18, 2019 at 15:18
  • If I don't try to load on my own jQuery, no jQuery is called.
    – Xarcell
    Jan 18, 2019 at 15:19
  • But jquery is specified in wp_register_script as dependency, and will be enqueued as well Jan 18, 2019 at 15:21
  • OK I see, it was loading in the header and I was looking in the footer for it. None of my scripts is working though.
    – Xarcell
    Jan 18, 2019 at 15:25
  • Then you'll have to debug your scripts. Jan 18, 2019 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.