Skip to Content

disable_wp_emojicons()

This completely disables Emoji support across the website.

PHP April 27, 2017

Usage

This function runs automatically, so it is not called manually. Is this incorrect?

Additional Notes

This saves at least 7 resource requests.

Source File

Located in /libs/Optimization.php on line 800.

1 Hook

Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.

Filters
"pre_disable_wp_emojicons"
Need a new filter hook? Request one here.

Actions
This function has no action hooks available. Request one?

PHP
        public function disable_wp_emojicons(){
            $override = apply_filters('pre_disable_wp_emojicons', null);
            if ( isset($override) ){return;}

            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');
        }

Override

To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):

PHP
add_filter('pre_disable_wp_emojicons', 'my_custom_disable_wp_emojicons'); 
function my_custom_disable_wp_emojicons(){ 
    //Write your own code here

    return true; //Return true to prevent the original function from running afterwords
}

You can completely disable this PHP function with a single line actions:

PHP
 add_filter('pre_disable_wp_emojicons', '__return_false');