Skip to content

fix: restore canonical emoji sizing CSS network-wide after deprecation-silence dropped it#93

Open
chubes4 wants to merge 1 commit into
mainfrom
fix-global-emoji-sizing
Open

fix: restore canonical emoji sizing CSS network-wide after deprecation-silence dropped it#93
chubes4 wants to merge 1 commit into
mainfrom
fix-global-emoji-sizing

Conversation

@chubes4

@chubes4 chubes4 commented Jul 5, 2026

Copy link
Copy Markdown
Member

Root cause

Giant emoji rendering site-wide across all 9 network sites (forum, blog, link pages, everywhere).

This plugin's inc/theme/emoji-deprecation.php removes print_emoji_styles on init to silence a noisy WP 6.4 deprecation notice (~640-840 hits/day per site in debug.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:

$action = is_admin() ? 'admin_print_styles' : 'wp_print_styles';
if ( ! has_action( $action, 'print_emoji_styles' ) ) {
    return;  // <-- emits NO sizing CSS
}

Core assumes that any plugin unhooking print_emoji_styles is taking over emoji styling itself, so it bows out. Because this plugin removes print_emoji_styles on init (which fires before wp_enqueue_scripts), the guard trips on every page load and core never emits the canonical img.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-smiley height rule is absent from the rendered forum HTML; has_action('wp_print_styles','print_emoji_styles') is false.

Fix

Emit core's canonical emoji sizing CSS ourselves through a supported path:

  • Front-end: wp_add_inline_style() attached to the theme's main stylesheet handle extrachill-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 at wp_enqueue_scripts priority 20). Hooked at priority 25 so the handle is already enqueued.
  • wp-admin: the same admin_print_styles removal dropped sizing in admin too (via the same early-return guard, since wp_enqueue_emoji_styles checks is_admin()). Admin has no theme stylesheet handle, so the same CSS is printed via a minimal <style> block on admin_head. This is our own style block — not the deprecated print_emoji_styles — so it emits no deprecation notice.
  • The CSS mirrors wp-includes/formatting.php:5878 exactly (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):

  • Forum (community.extrachill.com) — bbPress post/reply emoji
  • Blog (extrachill.com) — article + comment emoji
  • Link pages (artist.extrachill.com) — artist link-page emoji
  • Events, shop, newsletter, docs, wire, studio — all front-end pages

Confirmation

  • The WP 6.4 print_emoji_styles deprecation notice stays silenced — the remove_action calls are unchanged.
  • After this, img.emoji { height: 1em !important } is present on every page network-wide, so emoji render at text size everywhere.
  • If core ever resumes emitting the rule itself, the only effect is a harmless duplicate (both rules are identical and !important).
  • php -l passes on the changed file.
  • No CHANGELOG edit, no version bump (homeboy owns both).

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant