Skip to content

Commit

Permalink
Conditionally remove deprecated 'print_emoji_styles' (#54828)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored and mikachan committed Sep 26, 2023
1 parent 481fb9a commit 864177f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/compat/wordpress-6.4/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,22 @@ function _gutenberg_get_iframed_editor_assets_6_4() {
}
}

// Remove the deprecated `print_emoji_styles` handler.
// It avoids breaking style generation with a deprecation message.
remove_action( 'wp_print_styles', 'print_emoji_styles' );
/**
* Remove the deprecated `print_emoji_styles` handler.
* It avoids breaking style generation with a deprecation message.
*/
$has_emoji_styles = has_action( 'wp_print_styles', 'print_emoji_styles' );
if ( $has_emoji_styles ) {
remove_action( 'wp_print_styles', 'print_emoji_styles' );
}

ob_start();
wp_print_styles();
$styles = ob_get_clean();
add_action( 'wp_print_styles', 'print_emoji_styles' );

if ( $has_emoji_styles ) {
add_action( 'wp_print_styles', 'print_emoji_styles' );
}

ob_start();
wp_print_head_scripts();
Expand Down

0 comments on commit 864177f

Please sign in to comment.