fix: restore canonical emoji sizing CSS network-wide after deprecation-silence dropped it#93
Open
chubes4 wants to merge 1 commit into
Open
fix: restore canonical emoji sizing CSS network-wide after deprecation-silence dropped it#93chubes4 wants to merge 1 commit into
chubes4 wants to merge 1 commit into
Conversation
…n-silence dropped it
Removing print_emoji_styles to silence the WP 6.4 deprecation notice had an
unintended side effect: core's wp_enqueue_emoji_styles() (formatting.php) is
gated by a back-compat guard that early-returns and emits NO sizing CSS whenever
print_emoji_styles is no longer hooked. Because this plugin removes it on init
(fires before wp_enqueue_scripts), the guard trips on every page load and core
never emits the canonical img.emoji { height: 1em !important; ... } rule.
The emoji-replacement JS still converts text to <img class="emoji">, but those
images are now unsized and render at their natural (giant) dimensions on every
site in the network (forum, blog, link pages, everywhere).
Restore the canonical sizing CSS ourselves via the supported wp_add_inline_style
path attached to the theme's always-loaded main stylesheet handle
(extrachill-style), plus a minimal <style> echo on admin_head for wp-admin (which
has no theme handle and was also affected). This is our own style block, not the
deprecated print_emoji_styles, so no deprecation notice is reintroduced. The
deprecation silence itself stays in place.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Giant emoji rendering site-wide across all 9 network sites (forum, blog, link pages, everywhere).
This plugin's
inc/theme/emoji-deprecation.phpremovesprint_emoji_stylesoninitto silence a noisy WP 6.4 deprecation notice (~640-840 hits/day per site indebug.log). That silencing is correct and stays.But it had an unintended side effect. Core's
wp_enqueue_emoji_styles()(wp-includes/formatting.php:5870) is gated by a back-compat early-return guard:Core assumes that any plugin unhooking
print_emoji_stylesis taking over emoji styling itself, so it bows out. Because this plugin removesprint_emoji_stylesoninit(which fires beforewp_enqueue_scripts), the guard trips on every page load and core never emits the canonicalimg.emoji { height: 1em !important; ... }sizing rule.Core's emoji-replacement JS still runs everywhere (text →
<img class="emoji" src="...svg">), but those images are now unsized and render at their natural (huge) dimensions.Verified on production:
img.emoji/img.wp-smileyheight rule is absent from the rendered forum HTML;has_action('wp_print_styles','print_emoji_styles')isfalse.Fix
Emit core's canonical emoji sizing CSS ourselves through a supported path:
wp_add_inline_style()attached to the theme's main stylesheet handleextrachill-style— unconditionally enqueued on every front-end page on every site (it's the documented "always loaded" stylesheet;extrachill_modify_default_style()registers it with no conditions atwp_enqueue_scriptspriority 20). Hooked at priority 25 so the handle is already enqueued.admin_print_stylesremoval dropped sizing in admin too (via the same early-return guard, sincewp_enqueue_emoji_styleschecksis_admin()). Admin has no theme stylesheet handle, so the same CSS is printed via a minimal<style>block onadmin_head. This is our own style block — not the deprecatedprint_emoji_styles— so it emits no deprecation notice.wp-includes/formatting.php:5878exactly (verbatim copy of core's canonical rule).Scope
All 9 Extra Chill network sites (the plugin is network-active; the hook fires on every site):
community.extrachill.com) — bbPress post/reply emojiextrachill.com) — article + comment emojiartist.extrachill.com) — artist link-page emojiConfirmation
print_emoji_stylesdeprecation notice stays silenced — theremove_actioncalls are unchanged.img.emoji { height: 1em !important }is present on every page network-wide, so emoji render at text size everywhere.!important).php -lpasses on the changed file.