mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-06 13:44:30 +00:00
Script Loader: Add a check to see in style is registered in wp_maybe_inline_styles.
Add a check in `wp_maybe_inline_styles` to check that style is registered before processing items in queue. It is possible that developers may have called `wp_deregister_style`, unregistering style but the style still be in the queue to be processed. Without this check, typing to access the `src` property would result in a notice error. Follow on from [55888]. Props spacedmonkey, flixos90, dd32, kebbet. See #58394. git-svn-id: https://develop.svn.wordpress.org/trunk@55909 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2872,8 +2872,11 @@ function wp_maybe_inline_styles() {
|
||||
|
||||
// Build an array of styles that have a path defined.
|
||||
foreach ( $wp_styles->queue as $handle ) {
|
||||
if ( ! isset( $wp_styles->registered[ $handle ] ) ) {
|
||||
continue;
|
||||
}
|
||||
$src = $wp_styles->registered[ $handle ]->src;
|
||||
$path = wp_styles()->get_data( $handle, 'path' );
|
||||
$path = $wp_styles->get_data( $handle, 'path' );
|
||||
if ( $path && $src ) {
|
||||
$size = wp_filesize( $path );
|
||||
if ( ! $size ) {
|
||||
|
||||
Reference in New Issue
Block a user