While trying to fix the Render-Blocking issue on my website, I ran into a problem with the W3 Total Cache plugin on its Minify settings page.
The two buttons to add JS (Add a script) and CSS (Add a style sheet) are not working, nothing happens after clicking them.
The cause of the issue can be seen in the browser console error message (WP uses jQuery 1.12.4
, W3TC requires jQuery <1.9
)
Related question jQuery(...).live is not a function
options.js?ver=0.9.6:324
Uncaught TypeError: jQuery(...).live is not a function
at HTMLDocument.<anonymous> (options.js?ver=0.9.6:324)
at i (load-scripts.php?c=0&load[]=jquery-core,utils&ver=4.8.5:2)
at Object.fireWith [as resolveWith] (load-scripts.php?c=0&load[]=jquery-core,utils&ver=4.8.5:2)
at Function.ready (load-scripts.php?c=0&load[]=jquery-core,utils&ver=4.8.5:2)
at HTMLDocument.K (load-scripts.php?c=0&load[]=jquery-core,utils&ver=4.8.5:2)
options.js
is the file causing the issue on lines like this (jQuery(...).live
has been deprecated since jQuery 1.9):
jQuery('#pgcache__reject__logged_roles').live('click', function(){
w3tc_input_enable('#pgcache_reject_roles input[type=checkbox]', jQuery('#pgcache__reject__logged_roles:checked').size());
});
What would be the most acceptable and cleanest way to resolve the issue:
- Is there an updated W3TC plugin?
- Is there a clean way to make W3TC use different jQuery version than WP?
- Using a jQuery plugin like jQuery Migrate?
- Manually changing the affected lines?
jQuery
, not the default$
.jQuery
jQuery 1.12.4
gets loaded as part of WP-Includes (/www/wp-includes/js/jquery/jquery.js
)