In WordPress 4.2 a new set of emoji support was added to WordPress core. This new ’emoji support’ was in fact added as a disguise for a security update. The downside is that this also adds 1 or 2 additional JavaScript scripts (depending if you’re running SCRIPT_DEBUG
) to be loaded on your pageload, and if there are any emojis on the page it will also load additional .svg
assets for each emoji.
The additional resources could add a little bit of loading time before your full page is loaded. Its not like the assets or potential added load times are very big, but if you like optimizing your site this is a good way to do it.
Disabling the Emojis
If wanted you can use the Disable Emojis plugin, but personally I prefer to disable them through a small code snippet in my theme. I’m using the following to disable the WP 4.2 emoji and prevent the additional scripts from being loaded.
This removes the loading of the additional assets for the emoji from the page, saving approximately 5~11kb of page size (again depending on if you’re running SCRIPT_DEBUG
, in my screenshots I am).
Disabling Smilies
As you can see we’ve saved a couple KB from being loaded on the page, but its still showing a smiley. For plenty of (business) sites this may be undesired even when it doesn’t add any additional page size or load.
To disable these smilies too you can use the following code snippet;
This will result in simply outputting what you have actually typed;
The snippet removes the smiley conversion for all default content, which most importantly is the post content and any comments.
Wow that was odd. I just wrote an extremely long comment but after I clicked submit my comment didn’t show up. Grrrr well I’m not writing all that over again. Anyway, just wanted to say superb blog!