WordPress.org

Ready to get started?Download WordPress

Forums

wp_enqueue_script wont load jquery (6 posts)

  1. kingkong954
    Member
    Posted 4 years ago #

    When using wp_enqueue_script I cannot get Jquery to load.

    Plugins that attempt to load it also fail.

    I have wp_head and as well as wp_footer calls where necessary.

    No errors are thrown (by PHP) and it still happens when I disable all plugins.

    I am stumped.

  2. Aaron Jorbin
    Member
    Posted 4 years ago #

    Where are you putting your call to wp_enqueue_script? Try adding the following to your theme's functions.php file:

    <?php
    function my_jquery_init() {
        wp_enqueue_script('jquery');
    }    
    
    add_action('init', 'my_jquery_init');
    ?>
  3. kingkong954
    Member
    Posted 4 years ago #

    I tried that too -- no luck.

    I can place the call before or after the wp_head call.. it doesnt make a difference. No JQUERY is ever loaded.

  4. s_ha_dum
    Member
    Posted 4 years ago #

    I load jQuery into a theme (as well as other stuff that I've edited out) with the following with no problem:

    function theme_queue_js(){
        wp_enqueue_script('jquery');
    }
    add_action('get_header', 'theme_queue_js');

    Its worked through several WP versions so far.

  5. uwiuw
    Member
    Posted 4 years ago #

    @apljdi, what happen when you enter the dashboard ? is it still working ? Dashboard panel has its own jquery, is it ?

  6. s_ha_dum
    Member
    Posted 4 years ago #

    In practice, I filter it out of the admin section with an is_admin conditional. I think there is probably a less hackie way to do it but I haven't come back around to that project yet. I don't that that wp_enqueue_script with load the same file twice though.

Topic Closed

This topic has been closed to new replies.

About this Topic