Removing all emoji code from a ClassicPress site

Removing all emoji code from a ClassicPress site 1

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 code should be added near the end of your functions.php file (but before the final ?> if there is one).

The last line was not needed for WordPress sites, but is needed for ClassicPress. It prevents the site outputting a DNS Prefetch tag for the ClassicPress emoji subdomain, and therefore simplifies your GDPR disclosure obligations slightly.

ClassicPress version 2 should remove this fairly useless functionality altogether by shifting it to a core plugin. If you’d like to make sure it does, you can upvote the petition.

IMPORTANT

All content on the ZigPress website is copyrighted. You may not republish or syndicate any article or other content without explicit permission.

Add a Comment

If you have used this form and would like a copy of the information held about you on this website, or would like the information deleted, please email info@zigpress.com.