Disable Emojicons on your WordPress site

a minute read

Since version 4.2 release, WordPress now allows you to add the cool new Emojicons to your posts. In case you don’t know what emojicons are: they are the successor of Emoticons or smilies with more better graphics, and web platforms are quickly adopting them.

It was very easy to opt-out from using emoticons from the WordPress Writing Settings. As emojicons are succeeding emoticons, you can turn them off but this way you just can’t get rid of them completely:

Disabling WordPress emoticons
Emojicons can be turned off but they still add the code responsible for their styling and rendering.

But that is not enough. You still have the emojicons styles and JavaScript auto-enqueued in the header of your theme, which is unnecessary after you opted into not using emojicons.

Extra code added by WordPress emojicons
The extra bit of code added by WordPress emojicons—becomes useless when you don’t want

Removing WordPress Emojicons CSS and JS

As usual, WordPress (4.2+) hooks in some functions to implement the emojicons. In order to disable them, we need to unhook those functions with the help of some code.

Below given code snippet helps you to get rid of those extra bits of emojicon-specific CSS and JS from your WordPress themes. Remove the lines which don’t fit in your requirement:

function flush_emojicons() {
    // Remove from comment feed and RSS
    remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
    remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );

    // Remove from Emails
    remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );

    // Remove from the head, i.e. wp_head()
    remove_action( 'wp_head', 'print_emoji_detection_script', 7 );

    // Remove from Print-related CSS
    remove_action( 'wp_print_styles', 'print_emoji_styles' );

    // Remove from Admin area
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    remove_action( 'admin_print_styles', 'print_emoji_styles' );
add_action( 'init', 'flush_emojicons' );

Hope you found it useful. Cheers!

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

There are times when you need to disable comments on your WordPress site. There are two cases contextual to disabling WordPress comments: Disabling comments for individual posts and pages Disabling comments completely Disabling comments for individual WordPr...
The default WordPress search is the only thing that used to annoy me a lot and I wasn’t using it on any of my WordPress sites. There are a number of reasons back then to stop using WordPress search feature, and the best one for me was it throwing unrelated lin...
WordPress automatically adds its current Version number to the head section of the themes. If you view the source of a WordPress-based website, you may find out the WordPress version it is using. Below given is the meta tag that carries that version informatio...