Skip to content

Commit

Permalink
Editor: Fix deprecation notice in block editor.
Browse files Browse the repository at this point in the history
In [56682], the `print_emoji_styles` function was deprecated and a corresponding deprecation notice was added. In order to maintain backward compatibility, `print_emoji_styles` was retained as a hook into wp_print_styles. This resulted in the appearance of deprecation notices within the block editor. The root of this issue was the manual invocation of the `wp_print_styles` function in block-editor.php. To address this, the `print_emoji_styles` callback was manually removed, `wp_print_styles` was called, and the action was subsequently rehooked, resolving the deprecation notice within the block editor. 

Props mamaduka, hellofromtonya, spacedmonkey.
See #58775.

git-svn-id: https://develop.svn.wordpress.org/trunk@56706 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
spacedmonkey committed Sep 26, 2023
1 parent 35a4c22 commit 6a06786
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,24 @@ function _wp_get_iframed_editor_assets() {
}
}

/**
* 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();
wp_print_font_faces();
$styles = ob_get_clean();

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

ob_start();
wp_print_head_scripts();
wp_print_footer_scripts();
Expand Down

0 comments on commit 6a06786

Please sign in to comment.