Editor: Fix deprecation notice in block editor.

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.
Built from https://develop.svn.wordpress.org/trunk@56706


git-svn-id: http://core.svn.wordpress.org/trunk@56218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey 2023-09-26 12:28:22 +00:00
parent c8aea02b38
commit d969240845
2 changed files with 14 additions and 1 deletions

View File

@ -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(); ob_start();
wp_print_styles(); wp_print_styles();
wp_print_font_faces(); wp_print_font_faces();
$styles = ob_get_clean(); $styles = ob_get_clean();
if ( $has_emoji_styles ) {
add_action( 'wp_print_styles', 'print_emoji_styles' );
}
ob_start(); ob_start();
wp_print_head_scripts(); wp_print_head_scripts();
wp_print_footer_scripts(); wp_print_footer_scripts();

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.4-alpha-56705'; $wp_version = '6.4-alpha-56706';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.