Last active
August 29, 2015 14:24
-
-
Save simaovergalho/05203ebe11d173ed2e2b to your computer and use it in GitHub Desktop.
Disable Emojis on Wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 protected]> | |
*/ | |
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