The wordpress version of Zhiju has been upgraded recently. I am a lazy cancer patient and technically illiterate. I have been using wordpress3.9 before. After upgrading to the latest wordpress, when I checked the source code of the web page, I found that there was a long string in the header. The messy code looked like it was for emoticon loading or something like that. It was of no use to me and it looked very uncomfortable, so I removed it.
window._wpemojiSettings
The picture is too small, sorry... Anyway, this article is about adding the following code to the functions.php file of the theme through online search. Available:
/**Remove window._wpemojiSettings**/
remove_action( ""admin_print_scripts"", ""print_emoji_detection_script"");
remove_action( ""admin_print_styles"", ""print_emoji_styles"");
remove_action( ""wp_head"", ""print_emoji_detection_script"", 7);
remove_action( ""wp_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"");
While dealing with this problem, I accidentally saw someone mention another problem. Check the source code of the web page and there is the following sentence:
link rel=""dns-prefetch"" href=""//s.w.org"";
added dns-prefetch in the header to pre-fetch expressions and avatars from s.w.org, but s.w.org is not accessible at all in China. It should have no effect at all, and can be disabled, again by adding code to the theme's functions.php file.
Method 1
remove_action( ""wp_head"", ""wp_resource_hints"", 2 );
Method 2
function remove_dns_prefetch( $hints, $relation_type ) {
if ( "" dns-prefetch"" === $relation_type ) {
return array_diff( wp_dependencies_unique_hosts(), $hints );
}
return $hints;
}
add_filter( ""wp_resource_hints" ", ""remove_dns_prefetch"", 10, 2 );
It is said that the second one is more compatible, but the first one I use can also be used.
The code and methods involved in this article come from the Internet

postid
8107

Leave a Reply