mirror of
https://github.com/WordPress/WordPress.git
synced 2026-06-19 07:37:07 +00:00
Emoji: Use the admin_print_footer_scripts action for printing the emoji detection script in the admin.
This corrects an oversight in an optimization made to `print_emoji_detection_script()` which moved the emoji detection script to the `wp_print_footer_scripts` action. Since this action doesn't fire in the admin, no script was printed. Now in the admin, the script is printed at the `admin_print_footer_scripts` action. Existing sites that wish to omit emoji can continue to do `remove_action( 'admin_print_scripts', 'print_emoji_detection_script' )`. Tests are added covering all four branches of `print_emoji_detection_script()`: hooking the script onto the appropriate footer action, and printing it directly when that action has already fired, in both the admin and the frontend. Missing parameter and return types are added to the `get_echo()` test helper. Developed in https://github.com/WordPress/wordpress-develop/pull/11931. Follow-up to r60902. Props westonruter, jonsurrell. See #64076, #65260. Fixes #65310. Built from https://develop.svn.wordpress.org/trunk@62410 git-svn-id: http://core.svn.wordpress.org/trunk@61691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -5898,7 +5898,7 @@ function wp_enqueue_emoji_styles() {
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
function print_emoji_detection_script() {
|
||||
function print_emoji_detection_script(): void {
|
||||
static $printed = false;
|
||||
|
||||
if ( $printed ) {
|
||||
@@ -5907,10 +5907,18 @@ function print_emoji_detection_script() {
|
||||
|
||||
$printed = true;
|
||||
|
||||
if ( did_action( 'wp_print_footer_scripts' ) ) {
|
||||
_print_emoji_detection_script();
|
||||
if ( is_admin() ) {
|
||||
if ( did_action( 'admin_print_footer_scripts' ) ) {
|
||||
_print_emoji_detection_script();
|
||||
} else {
|
||||
add_action( 'admin_print_footer_scripts', '_print_emoji_detection_script' );
|
||||
}
|
||||
} else {
|
||||
add_action( 'wp_print_footer_scripts', '_print_emoji_detection_script' );
|
||||
if ( did_action( 'wp_print_footer_scripts' ) ) {
|
||||
_print_emoji_detection_script();
|
||||
} else {
|
||||
add_action( 'wp_print_footer_scripts', '_print_emoji_detection_script' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.1-alpha-62409';
|
||||
$wp_version = '7.1-alpha-62410';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user