#65310 closed defect (bug) (fixed)
Emoji detection script not being printed in admin
| Reported by: | westonruter | Owned by: | westonruter |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.0.1 |
| Component: | Emoji | Version: | 6.9 |
| Severity: | normal | Keywords: | has-patch has-unit-tests fixed-major dev-reviewed |
| Cc: | Focuses: |
Description
This is a follow-up to an issue introduced in r60902 (3cba156) to fix #63842 and #64076 in the 6.9 release.
The change to print the emoji detection script in the footer instead of the head was only accounting for its use on the frontend. It neglected to account for the hooks in the admin, where the wp_print_footer_scripts action never fires. Instead, the admin_print_footer_scripts action fires. The following change is needed:
-
src/wp-includes/formatting.php
a b function print_emoji_detection_script() { 5907 5907 5908 5908 $printed = true; 5909 5909 5910 if ( did_action( 'wp_print_footer_scripts' ) ) { 5911 _print_emoji_detection_script(); 5910 if ( is_admin() ) { 5911 if ( did_action( 'admin_print_footer_scripts' ) ) { 5912 _print_emoji_detection_script(); 5913 } else { 5914 add_action( 'admin_print_footer_scripts', '_print_emoji_detection_script' ); 5915 } 5912 5916 } else { 5913 add_action( 'wp_print_footer_scripts', '_print_emoji_detection_script' ); 5917 if ( did_action( 'wp_print_footer_scripts' ) ) { 5918 _print_emoji_detection_script(); 5919 } else { 5920 add_action( 'wp_print_footer_scripts', '_print_emoji_detection_script' ); 5921 } 5914 5922 } 5915 5923 }
Related: #65260
Change History (12)
This ticket was mentioned in PR #11931 on WordPress/wordpress-develop by @westonruter.
2 months ago
#2
- Keywords has-patch has-unit-tests added
@westonruter commented on PR #11931:
2 months ago
#3
@westonruter commented on PR #11931:
2 months ago
#5
It also seems to fix https://core.trac.wordpress.org/ticket/65260 in my testing in Firefox
This is surprising!
#8
@
8 weeks ago
- Keywords dev-reviewed added; dev-feedback removed
Approving r62410 for 7.0.1 backport.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This fixes the emoji detection script not being printed in the admin.
This is a follow-up to a regression introduced in 3cba156 (r60902), which fixed #63842 and #64076 in the 6.9 release. That change moved the emoji detection script from the document head to the footer, but only accounted for the front end: it hooked
_print_emoji_detection_scriptonto thewp_print_footer_scriptsaction, which never fires in the admin. Theadmin_print_footer_scriptsaction fires there instead, so the script was never printed in the admin.print_emoji_detection_script()now branches onis_admin()and uses the appropriate footer action for each context.### Changes
print_emoji_detection_script()to hook_print_emoji_detection_scriptontoadmin_print_footer_scriptsin the admin andwp_print_footer_scriptson the front end, and to print directly when that action has already fired.print_emoji_detection_script()— hooking onto the correct footer action, and printing the script directly when that action has already fired — in both admin and front-end contexts.get_echo()test helper.## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.7
Used for: Authoring the PHPUnit tests for
print_emoji_detection_script(). All AI-generated code was reviewed, directed, and edited by me.