Disable emoji on wordpress
Emoji in WordPress appeared from the version 4.2. Emoji are sets of emoticons that are most often not used., in my practice, I came across sites that used them more by chance than on purpose. In 99% cases it is better to turn them off, in my case, I decided to disable them for the cleanliness of the code in the header and for a small but still speed up the loading of the site. How WordPress Pulls in Emoji from External Libraries, disabling these emojis will help reduce the number of requests.
In my case, the Google PageSpeed Insights service needed the maximum possible acceleration and disabling added a bit of speed. Those who read my site know that I like to use codes and use plugins to a minimum.. I will offer you 2 shutdown option, and you have to choose which one to use.
1 way: code to disable emoji in wordpress
Paste the code into functions.php in the theme of the site or create your own plugin.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
function disable_wp_emojicons() { // Все экшены, связанные с emojis remove_action( 'admin_print_styles', 'print_emoji_styles' ); 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_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); // Фильтр для удаления emojis TinyMCE add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' ); } add_action( 'init', 'disable_wp_emojicons' ); function disable_emojicons_tinymce( $plugins ) { if ( is_array( $plugins ) ) { return array_diff( $plugins, array( 'wpemoji' ) ); } else { return array(); } } add_filter( 'emoji_svg_url', '__return_false' ); |
2 way: plugin to disable emoji in wordpress
If you do not understand where to insert the code and want to quickly disable Emoji, I suggest a plugin Disable Emojis.
I will be glad for your comments.
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.