in WordPress

Disable Emojicons Introduced In WordPress 4.2

As of WordPress version 4.2 WordPress enabled the use of Emojicons in your posts, but in order to do this it will automatically add some javascript to your page. But if you don't use Emojicons then it's adding pointless Javascript to the page which you will never use. If you look inside the file /wp-includes/default-filters.php you will see all the filters and actions that are used to add the emoji code, all you have to do is search for the word emoji in this file to see the instances of these filters and actions. Then you will have to go through each of these and remove them in your own code by using the functions remove_filter and remove_action which can be ran on the init action.

function pu_remove_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 head tag
    remove_action( 'wp_head', 'print_emoji_detection_script', 7 );

    // Remove from print related styling
    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', 'pu_remove_emojicons' );

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email