12 ); |
12 ); |
13 } |
13 } |
14 |
14 |
15 /** |
15 /** |
16 * Disable the emoji's |
16 * Disable the emoji's |
|
17 * from https://wordpress.org/plugins/disable-emojis/ |
17 */ |
18 */ |
18 function disable_emojis() { |
19 function disable_emojis() { |
19 remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); |
20 remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); |
20 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); |
21 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); |
21 remove_action( 'wp_print_styles', 'print_emoji_styles' ); |
22 remove_action( 'wp_print_styles', 'print_emoji_styles' ); |
22 remove_action( 'admin_print_styles', 'print_emoji_styles' ); |
23 remove_action( 'admin_print_styles', 'print_emoji_styles' ); |
23 remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); |
24 remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); |
24 remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); |
25 remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); |
25 remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); |
26 remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); |
26 add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' ); |
27 add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' ); |
|
28 add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 ); |
27 } |
29 } |
28 add_action( 'init', 'disable_emojis' ); |
30 add_action( 'init', 'disable_emojis' ); |
29 |
31 |
30 /** |
32 /** |
31 * Filter function used to remove the tinymce emoji plugin. |
33 * Filter function used to remove the tinymce emoji plugin. |
32 * |
34 * |
33 * @param array $plugins |
35 * @param array $plugins |
34 * @return array Difference betwen the two arrays |
36 * @return array Difference betwen the two arrays |
35 */ |
37 */ |
36 function disable_emojis_tinymce( $plugins ) { |
38 function disable_emojis_tinymce( $plugins ) { |
37 if ( is_array( $plugins ) ) { |
39 if ( is_array( $plugins ) ) { |
38 return array_diff( $plugins, array( 'wpemoji' ) ); |
40 return array_diff( $plugins, array( 'wpemoji' ) ); |
39 } else { |
41 } else { |
40 return array(); |
42 return array(); |
41 } |
43 } |
42 } |
44 } |
|
45 |
|
46 |
|
47 /** |
|
48 * Remove emoji CDN hostname from DNS prefetching hints. |
|
49 * |
|
50 * @param array $urls URLs to print for resource hints. |
|
51 * @param string $relation_type The relation type the URLs are printed for. |
|
52 * @return array Difference betwen the two arrays. |
|
53 */ |
|
54 function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) { |
|
55 |
|
56 if ( 'dns-prefetch' == $relation_type ) { |
|
57 |
|
58 // Strip out any URLs referencing the WordPress.org emoji location |
|
59 $emoji_svg_url_bit = 'https://s.w.org/images/core/emoji/'; |
|
60 foreach ( $urls as $key => $url ) { |
|
61 if ( strpos( $url, $emoji_svg_url_bit ) !== false ) { |
|
62 unset( $urls[$key] ); |
|
63 } |
|
64 } |
|
65 |
|
66 } |
|
67 |
|
68 return $urls; |
|
69 } |