forked from vincentorback/clean-wordpress-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemojis.php
51 lines (42 loc) · 1.27 KB
/
emojis.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* Remove emoji support
*
* @link https://wordpress.org/support/article/using-smilies/
*/
add_action(
'init',
function () {
// Front-end
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
// Admin
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
// Feeds
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
// Embeds
remove_filter( 'embed_head', 'print_emoji_detection_script' );
// Emails
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
// Disable from TinyMCE editor. Disabled in block editor by default
add_filter(
'tiny_mce_plugins',
function ( $plugins ) {
if ( is_array( $plugins ) ) {
$plugins = array_diff( $plugins, array( 'wpemoji' ) );
}
return $plugins;
}
);
/**
* Finally, disable it from the database also, to prevent characters from converting
* There used to be a setting under Writings to do this
* Not ideal to get & update it here - but it works :/
*/
if ( (int) get_option( 'use_smilies' ) === 1 ) {
update_option( 'use_smilies', 0 );
}
}
);