💾 Archived View for danq.me › posts › wordpress-stop-emoji-images captured on 2023-11-04 at 11:21:48. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-09-28)
-=-=-=-=-=-=-
2023-09-04
After sharing that Octopuns has started posting again after a 9½-year hiatus earlier today, I noticed something odd: where I'd written "I ❤️ FreshRSS", the heart emoji was huge when viewed in my favourite feed reader.
It turns out that by default, WordPress replaces emoji in its feeds (and when sending email) with images of those emoji, using the Tweemoji set, and with the alt-text set to the original emoji. These images are hosted at https://s.w.org/images/core/emoji/...-based URLs.
For example, this heart was served with the following HTML code (the number 2764 refers to the codepoint of the emoji):
<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2764.png" alt="❤" class="wp-smiley" style="height: 1em; max-height: 1em;" />
I can see why this functionality was added: what if the feed reader didn't support Unicode or didn't have a font capable of showing the appropriate emoji?
But I can also see reasons why it might not be desirable to everybody. For example:
I opted to remove this functionality. I briefly considered overriding the emoji_url filter (which could be used to selfhost the emoji set) but I discovered that I could just un-hook the filters that were being added in the first place.
Here's what I added to my theme's functions.php:
remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
That's all there is to it. Now, my feed reader shows my system's emoji instead of a huge image:
I'm always grateful to discover that a piece of WordPress functionality, whether core or in an extension, makes proper use of hooks so that its functionality can be changed, extended, or disabled. One of the single best things about the WordPress open-source ecosystem is that you almost never have to edit somebody else's code (and remember to re-edit it every time you install an update).
Want to hear about other ways I've improved WordPress's feeds?
My note sharing that Octopuns has started publishing again
My blog post about my FreshRSS addiction
FreshRSS - my favourite feed reader
Compart.com page about codepoint U+2764