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:
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:
WP Admin normally loads the migrate script automatically. Apparently your theme dequeued/deregistered that script (too).
The upcoming release fixes issues with calls to the deprecated live() function in cases like yours where the migrate script doesn't work or is not loaded.
jQuery
, not the default$
. – Milo Commented Feb 4, 2018 at 2:14jQuery
– Peter Gerhat Commented Feb 4, 2018 at 9:40jQuery 1.12.4
gets loaded as part of WP-Includes (/www/wp-includes/js/jquery/jquery.js
) – Peter Gerhat Commented Feb 4, 2018 at 14:24