Disable WordPress emojis in RSS Feed

I've had an issue with my RSS feed and the emoji images WordPress replaces by default.

My content had emojis, so they would get replaced to images in the feed. Then, Mailchimp would use width: 100% on all images from my posts. Which, when you think about it, is great because it makes sure my images look good in desktop and mobile (email clients).

The issue was, the emoji images would also get a wide width. As you can imagine, the emoji images were massive.

To fix that, I've created a super straight forward plugin with help from Stack Overflow.


/*
Plugin Name: Disable Emoji Images in Feed
Plugin URI: https://ricard.dev
 * Description: It disabled the emoji images convertion leaving the original emoji character. I want to prevent Mailchimp from showing them full width
 * Version: 1.0
 * Author: quicoto
 * Author URI: https://ricard.dev
*/


function disable_wp_emojicons() {
  remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
  remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
}

add_action( 'init', 'disable_wp_emojicons' );
</code>Code language: JavaScript (javascript)

You can filter it everywhere if you need to: https://wordpress.stackexchange.com/questions/185577/disable-emojicons-introduced-with-wp-4-2

Comments

  1. Ryan says:

    Thank you for this code snippet!

    1. You’re welcome Ryan.

  2. saif ali says:

    thanx for upload this artical helpful for us

    1. Rick says:

      You’re welcome!

Leave a Reply

Your email address will not be published. Required fields are marked *