Description
Bug Description
If visiting a wordpress page where I removed admin bar styles, AMP throws
Warning: Undefined array key "admin-bar" in XXX/wp-content/plugins/amp/includes/class-amp-theme-support.php on line 1382
I removed the styles (and the whole admin bar) with
add_filter( 'show_admin_bar', '__return_false' );
wp_deregister_style( 'admin-bar' );
If I take out wp_deregister_style( 'admin-bar' );
it works again.
Expected Behaviour
Should not throw warning
Screenshots
No response
PHP Version
8.2
Plugin Version
2.5.3
AMP plugin template mode
Standard
WordPress Version
No response
Site Health
No response
Gutenberg Version
No response
OS(s) Affected
No response
Browser(s) Affected
No response
Device(s) Affected
No response
Acceptance Criteria
No response
Implementation Brief
on line 1382 includes/class-amp-theme-support.php you should replace
is_array( wp_styles()->registered['admin-bar']->deps ) && in_array( $handle, wp_styles()->registered['admin-bar']->deps, true ) ? [..]
by
isset( wp_styles()->registered['admin-bar']->deps ) && is_array( wp_styles()->registered['admin-bar']->deps ) && in_array( $handle, wp_styles()->registered['admin-bar']->deps, true ) ? [..]
(add an isset())
QA Testing Instructions
No response
Demo
No response
Changelog Entry
No response
Metadata
Metadata
Assignees
Type
Projects
Status