Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Narayon/e9cedd6cf43bab58c41c to your computer and use it in GitHub Desktop.
Save Narayon/e9cedd6cf43bab58c41c to your computer and use it in GitHub Desktop.
Wordpress: Disable Emojis
<?php
/**
* Disable Emojis
*
* @package Package
* @subpackage Package/SubPackage
* @copyright Copyright (c) 2014, Your Name
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 0.0.1
* @author Your Name <email@domain.com>
*/
if( !class_exists( 'PREFIX_Disable_Emojis' ) ) {
class PREFIX_Disable_Emojis {
/**
* Initialize the class
*
* @since 0.0.1
*/
public function __construct() {
add_action( 'init', array( $this, 'remove_filters' ) );
add_action( 'init', array( $this, 'add_filters' ) );
$this->remove_tinymce_plugin();
}
/**
* Remove Filters
*
* @since 0.0.1
* @return void
*/
public function remove_filters() {
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_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
}
/**
* Add Filters
*
* @since 0.0.1
* @return void
*/
public function add_filters() {
add_filter( 'tiny_mce_plugins', array( $this, 'remove_tinymce_plugin' ) );
}
/**
* Disable TinyMCE Plugin
*
* @since 0.0.1
* @return void
*/
public function remove_tinymce_plugin() {
global $plugins;
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}
}
} // end PREFIX_Disable_Emojis
/**
* Usage
*/
$disable_emojis = new PREFIX_Disable_Emojis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment