Simple way to disable loading the SVG Emoji in WordPress.
WordPress includes an SVG image for every emoji it uses. While these SVGs are relatively small, they can add to the page size and load time of your site, especially if you are using a lot of emojis on your pages.
Disabling the loading of SVG emojis in WordPress can help improve page load times, reduce the number of HTTP requests and improve the performance of your site.
Here are some reasons why you might want to disable loading of SVG emojis in WordPress:
- Improved site performance: Disabling SVG emojis can help reduce page size and load times, which can help improve the performance of your site.
- Reduced server load: By disabling SVG emojis, you can reduce the number of HTTP requests and improve the load time of your site, which can help reduce the load on your server.
- Better control over site appearance: By disabling SVG emojis, you can ensure that your site’s appearance is consistent across different devices and browsers.
To disable loading of SVG emojis in WordPress, you can add the following code to your functions.php file:
function disable_svg_emojis() { remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'wp_print_styles', 'print_emoji_styles' ); remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); remove_action( 'admin_print_styles', 'print_emoji_styles' ); remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); add_filter( 'tiny_mce_plugins', 'disable_svg_emojis_tinymce' ); } add_action( 'init', 'disable_svg_emojis' ); function disable_svg_emojis_tinymce( $plugins ) { if ( is_array( $plugins ) ) { return array_diff( $plugins, array( 'wpemoji' ) ); } else { return array(); } }
This code will remove the actions and filters that load SVG emojis in WordPress, which will prevent them from being loaded on your site.
Note that this code will also remove the regular PNG emojis that are part of WordPress, so make sure to test your site thoroughly after implementing this change to ensure that it does not affect the appearance or functionality of your site.
Is there any other way to disable loading the SVG Emoji in WordPress
Yes.
- Download plugin Crunchy Booster.
- Enable toggle: Disable loading the SVG Emoji.
That’s it. And you are all set.
Crunchy Booster is the Simplest WordPress Optimizer & Customizer Plugin!
It provides simplest, light weight, most powerful All-in-One 50+ Optimization
, Customization, Webmaster, Database, Configuration, WordPress fine-tuning options in single plugin.