New WordPress Plugin Serves Pre-Compressed Emoji

WordPress emoji are served from s.w.org, but they are not compressed. This impacts the SVG loading time, depending on how many emoji you are using, and can even throw warnings on Google’s PageSpeed Insights tool. Turkey-based WordPress developer Mustafa Uysal has just released Compressed Emoji, a plugin that makes use of the emoji_svg_url filter introduced in 4.6. This filter allows developers to change the URL for where emoji SVG images are hosted.

When the plugin is activated, the compression offers savings in the range of 3kb ~ 1.3kb (roughly %60) per emoji.

Uysal said he hopes WordPress.org will consider compressing emoji in the future, especially since approximately 10% of the web is using WordPress 4.6. Compressing emoji is a small way to speed up a sizeable chunk of the web. A ticket was created on Trac four months ago, requesting cache headers for emoji files and compression. According to Gary Pendergast, the change is something that can be made outside of the WordPress core development cycle, so he closed the ticket and passed the suggestion on to the Systems team. Cache headers were added by the team, but compression was not implemented in that update.

“The current plan is to move everything to a new CDN,” Gary Pendergast reported after chatting with the Systems team. “The current CDN is a bit outdated – they don’t support HTTP/2, for example. They need to do some more testing, but it’s high on the todo list.”

In the meantime, users who want compressed emoji can use Uysal’s plugin. It compressed the files using SVGO, an open source Node.js-based tool for optimizing SVG vector graphics files. The tool removes unnecessary things like metadata, comments, hidden elements, and default or non-optimal values from the SVG files without affecting their rendering. Another advantage is it doesn’t require an internet connection for those who are developing locally.

Compressed Emoji is available in the WordPress plugin directory and is also open for contributions on GitHub.