As the webmaster of the WordPress website, we may often encounter some strange problems: the WordPress background cannot open the display blank, and the WordPress background opens very slowly. We have to ask: Why can't WordPress open the background? Why does WordPress open very slowly in the background ? Yes, why? If it is slow on the website, it is understandable, but it is also wrong in the local environment on the local computer. I remember that the Gaoshi Silver Blog also mentioned some methods of WordPress background speed increase in the previous chapters, but they all explained from a certain method. In this chapter, Gaoshiyin Blog will give a comprehensive explanation“ Wordpress cannot open the background and is slow to open ”。
First, let's explain that the background of WordPress is blank, not because it can't be opened, but because WordPress programs have been connecting to foreign servers, such as checking the update of some plug-ins or themes, WordPress user avatars, and Google fonts. Therefore, if we want to solve the problem that WordPress cannot open the background and opens slowly, we should start from some aspects and put the code provided below into the functions.php file of your theme.
Step 1: Disable Google fonts. The codes are as follows:
//Remove Google Fonts
add_action( 'init', 'disableGoogleFont');
function disableGoogleFont(){
wp_deregister_style("open-sans");
wp_register_style("open-sans",false);
}
Step 2: cache gravatar avatar through the talker server. The codes are as follows:
//Accelerate Gravatar avatar through multi talk server
function mytheme_get_avatar($avatar) {
$avatar = str_replace(array("hongchengtech.cn","0.hongchengtech.cn","1.hongchengtech.cn","2.hongchengtech.cn"),"kuzhuti.duoshuo.com",$avatar);
return $avatar;
}
add_filter( 'get_avatar', 'mytheme_get_avatar', 10, 3 );
Of course, you can also use other domestic servers to cache gravatar avatars, such as the Qiniu server.
Step 3: Disable plug-in and theme check updates. The codes are as follows:
//Prevent plug-ins or themes from checking for updates,
add_filter("pre_http_request", disable_plugin_request,10,3);
function disable_plugin_request($a,$b,$c){
if(isset($b['body']['plugins']) || isset($b['body']['themes']))
return array('response'=>array('code'=>404));
return false;
}
If you do not want to disable the plug-in or theme update check, you should not use the plug-in or theme that the server has placed abroad, because it is very slow to open foreign servers in China, or even cannot open them, such as Google servers.
Through the above steps, the WordPress background will no longer be blank and cannot be opened, and the speed of WordPress background opening will be greatly improved. If through these steps, your WordPress background still cannot be opened, that is, your WordPress program or WordPress theme or your website space has a problem. You can try to upload the WordPress program or WordPress theme again, or change a better website space.