Skip to content

Commit 6a06786

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@56706 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 35a4c22 commit 6a06786

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/wp-includes/block-editor.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,24 @@ function _wp_get_iframed_editor_assets() {
359359
}
360360
}
361361

362+
/**
363+
* Remove the deprecated `print_emoji_styles` handler.
364+
* It avoids breaking style generation with a deprecation message.
365+
*/
366+
$has_emoji_styles = has_action( 'wp_print_styles', 'print_emoji_styles' );
367+
if ( $has_emoji_styles ) {
368+
remove_action( 'wp_print_styles', 'print_emoji_styles' );
369+
}
370+
362371
ob_start();
363372
wp_print_styles();
364373
wp_print_font_faces();
365374
$styles = ob_get_clean();
366375

376+
if ( $has_emoji_styles ) {
377+
add_action( 'wp_print_styles', 'print_emoji_styles' );
378+
}
379+
367380
ob_start();
368381
wp_print_head_scripts();
369382
wp_print_footer_scripts();

0 commit comments

Comments
 (0)