diff --git a/src/wp-admin/includes/admin-filters.php b/src/wp-admin/includes/admin-filters.php
index 8e3da338c5..b5adb946cf 100644
--- a/src/wp-admin/includes/admin-filters.php
+++ b/src/wp-admin/includes/admin-filters.php
@@ -60,7 +60,8 @@ if ( ! is_customize_preview() ) {
add_action( 'admin_print_scripts', 'print_emoji_detection_script' );
add_action( 'admin_print_scripts', 'print_head_scripts', 20 );
add_action( 'admin_print_footer_scripts', '_wp_footer_scripts' );
-add_action( 'admin_print_styles', 'print_emoji_styles' );
+add_action( 'admin_enqueue_scripts', 'wp_enqueue_emoji_styles' );
+add_action( 'admin_print_styles', 'print_emoji_styles' ); // Retained for backwards-compatibility. Unhooked by wp_enqueue_emoji_styles().
add_action( 'admin_print_styles', 'print_admin_styles', 20 );
add_action( 'admin_print_scripts-index.php', 'wp_localize_community_events' );
diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php
index ca35a56ae8..d58e9874ed 100644
--- a/src/wp-includes/admin-bar.php
+++ b/src/wp-includes/admin-bar.php
@@ -1225,32 +1225,51 @@ function wp_admin_bar_add_secondary_groups( $wp_admin_bar ) {
}
/**
- * Prints style and scripts for the admin bar.
+ * Enqueues inline style to hide the admin bar when printing.
*
- * @since 3.1.0
+ * @since 6.4.0
*/
-function wp_admin_bar_header() {
- $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
- ?>
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- 'Example',
);
diff --git a/tests/phpunit/tests/oembed/template.php b/tests/phpunit/tests/oembed/template.php
index fca6aadd95..12092ff669 100644
--- a/tests/phpunit/tests/oembed/template.php
+++ b/tests/phpunit/tests/oembed/template.php
@@ -10,6 +10,8 @@ class Tests_Embed_Template extends WP_UnitTestCase {
global $wp_scripts;
$wp_scripts = null;
+
+ remove_action( 'wp_print_styles', 'print_emoji_styles' );
}
public function tear_down() {
diff --git a/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php b/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php
index 02ae7e0253..b009ac7233 100644
--- a/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php
+++ b/tests/phpunit/tests/theme/wpAddGlobalStylesForBlocks.php
@@ -18,6 +18,11 @@ class Tests_Theme_WpAddGlobalStylesForBlocks extends WP_Theme_UnitTestCase {
*/
private $test_blocks = array();
+ public function set_up() {
+ parent::set_up();
+ remove_action( 'wp_print_styles', 'print_emoji_styles' );
+ }
+
public function tear_down() {
// Unregister test blocks.
if ( ! empty( $this->test_blocks ) ) {