W3 Total Cache
jQuery not defined, not even combined with other scripts (1 post)

  1. donwilson
    Posted 2 years ago #


    We're having a random issue with W3TC regarding jQuery and our pages. Most of the javascript files are successfully combined into one minified script, however jQuery isn't one of them and isn't even being combined at all. It's even being inserted quite a few lines after the scripts that are included with a wp_enqueue_script call (including ones that label jQuery has a dependency).

    The following code is how I'm injecting our theme's JavaScript using the wp_enqueue_scripts action

    // JavaScript enqueueing
    add_action("wp_enqueue_scripts", function() {
    if(is_admin()) { return; }

    wp_enqueue_script('cnwMain', get_template_directory_uri() ."/scripts/main.js", array('jquery'));

    if(preg_match("#^/?dl/#si", getenv("REQUEST_URI"))) {
    wp_enqueue_script('jquery.cookie', get_template_directory_uri() ."/scripts/jquery.cookie.js", array('jquery'));
    }, 1, 1);

    I have the template function wp_head() right before closing the head tag, so I'm not sure what else we should be doing.

    Our minify settings: http://i.imgur.com/N8aKiE7.png

    I've checked our custom-written plugins and they utilize wp_enqueue_scripts correctly as well, so I don't think those are to blame. It seems like W3TC isn't following the dependencies list correctly?


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • W3 Total Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.