Removing all emoji code from a ClassicPress site

Originally published at: https://www.classicpress.net/blog/removing-all-emoji-code-from-a-classicpress-site/

Here’s a quick tip for ClassicPress theme developers. If you want to remove all trace of the WordPress/ClassicPress built-in emoji scripts, styles and tags from your ClassicPress site’s pages, here is the code that you need to add to your theme’s functions.php file: remove_action(‘wp_head’, ‘print_emoji_detection_script’, 7); remove_action(‘admin_print_scripts’, ‘print_emoji_detection_script’); remove_action(‘wp_print_styles’, ‘print_emoji_styles’); remove_action(‘admin_print_styles’, ‘print_emoji_styles’); add_filter(‘emoji_svg_url’, ‘__return_false’); This…

5 Likes

Are you sure about this part? I’d expect WP 4.9.12 and ClassicPress to behave the same way here.

This is going to be first on the chopping block for v2, because it is the top-voted petition and not terribly difficult to remove (for example the Customizer would be another story). However I think it is actually pretty useful.

If your site content, or visitors’ comments, use emoji then they will appear differently to visitors depending on their OS and device type. Some emoji do not even look close to the same thing across platforms:

And for most Linux users this will probably look something like a box with some numbers in it instead of a face.

The emoji code is not implemented in a very performant way, but it normalizes all of this.

2 Likes

Good point re the first quote. The last time I checked on a WP site was pre-4.8 so it may have become necessary for both WP and CP since that check. But anyway it’s certainly necessary now on CP. Maybe I should remove that particular sentence to avoid any confusion.

Re the second quote, it’s a subjective issue, but I think removing it for business sites that don’t permit comments is a sensible thing to do.

4 Likes