Hello,
I also got this notice when wp_debug
was enabled.
dwinden, you are correct, the line number has changed to 220.
The theme I used had wp_deregister_script('jquery')
in it’s functions.php file. That was why $wp_scripts->registered['jquery']
was not an object.
I changed line 220 to:
if ( is_object ( $wp_scripts->registered['jquery'] ) ) {
$jquery_ver = $wp_scripts->registered['jquery']->ver;
} else {
$jquery_ver = null;
}
This got rid of the notice. Themes deregistering jquery is probably not good practice, but with this check you can avoid the notice when using such themes.
p.s. sorry if there are formatting errors. Just created this account to post this.
Edit: This actually gave me another notice (undefined index jquery
). What I use now:
if ( isset ( $wp_scripts->registered['jquery'] ) && is_object ( $wp_scripts->registered['jquery'] ) ) {
$jquery_ver = $wp_scripts->registered['jquery']->ver;
} else {
$jquery_ver = null;
}