WordPress.org

Support

Support » How-To and Troubleshooting » wp_enqueue_script wont load jquery

wp_enqueue_script wont load jquery

  • kingkong954
    Member

    @kingkong954

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Aaron Jorbin
    Participant

    @jorbin

    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');
    ?>

    kingkong954
    Member

    @kingkong954

    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.

    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.

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

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_enqueue_script wont load jquery’ is closed to new replies.