Original: Http://www.tuicool.com/articles/6bayeq
Recently the domestic Google has started a new round of shielding, many WordPress users found a phenomenon, that is, the site foreground and background open are very slow, careful observation, will find each time is loaded fonts.googleapis.com card here. What's the reason for that? And how to solve it?
Daiming Blog also encountered the same problem, tried several methods, the final solution is to modify a portion of CSS and PHP, and comment out the fonts.googleapis.com about the content. The following are explained separately.
First look at how to fix the "fonts.googleapis.com" that has been loaded .
In the first step, the new google-font.css is placed in the \wp-includes\css directory (the contents of the CSS file are as follows):
@font-face {
font-family: ' Open Sans ';
Font-style:normal;
font-weight:300;
Src:local (' Open Sans Light '), local (' Opensans-light '), url (.. /fonts/google/dxi1orhcpsqm3vp6mxoatra1rvmpjeky21_gqjallji.woff) format (' Woff ');
}
@font-face {
font-family: ' Open Sans ';
Font-style:normal;
font-weight:400;
Src:local (' Open Sans '), local (' Opensans '), url (.. /fonts/google/u-wuoqret9fueobqw7jkrt8e0i7kzn-epnyo3hzu7kw.woff) format (' Woff ');
}
@font-face {
font-family: ' Open Sans ';
Font-style:normal;
font-weight:600;
Src:local (' Open Sans semibold '), local (' Opensans-semibold '), url (.. /fonts/google/mtp_ysujh_bn48vbg8snsha1rvmpjeky21_gqjallji.woff) format (' Woff ');
}
@font-face {
font-family: ' Open Sans ';
Font-style:italic;
font-weight:300;
Src:local (' Open Sans Light Italic '), local (' Opensanslight-italic '), url (.. /fonts/google/prmixeptr36kac0geaetxrsuofak0levemleqytnfay.woff) format (' Woff ');
}
@font-face {
font-family: ' Open Sans ';
Font-style:italic;
font-weight:400;
Src:local (' Open Sans Italic '), local (' Opensans-italic '), url (.. /fonts/google/xjajxh38i15wypjxxugmbtih4imgi8p11rfo6ypcpc0.woff) format (' Woff ');
}
@font-face {
font-family: ' Open Sans ';
Font-style:italic;
font-weight:600;
Src:local (' Open Sans semibold Italic '), local (' Opensans-semibolditalic '), url (.. /fonts/google/prmixeptr36kac0geaetxmweb5poa5ztb49ylyuzh1a.woff) format (' Woff ');
}
The second step, modify the \wp-includes\script-loader.php file, find:
$open _sans_font_url = "//fonts.googleapis.com/css?family=open+sans:300italic,400italic,600italic,300,400,600 &subset= $subsets ";
Replace with:
$open _sans_font_url = "/wp-includes/css/google-font.css";
Third, find functions.php in the wordpress template file and use "//" to comment out the reference to the Google Font Library section. Here are different according to each template, Daiming blog is the following here:
function govpress_fonts () {
Add genericons font, used in the main stylesheet.
Wp_enqueue_style (' Fontawesome ', Get_template_directory_uri (). '/fonts/font-awesome/font-awesome.css ', Array (), ' 4.0.3′ ');
Wp_register_style (' Govpress-open-sans ', '//fonts.googleapis.com/css?family=open+sans:300italic,400italic, 600italic,700italic,400,600,700,300′, ", NULL, ' screen ');
Wp_enqueue_style (' Govpress-open-sans ');
OK, now is not loaded fonts.googleapis.com it? The problem is solved.
So what is the reason for this ?
The reason is that the recent Google HTTPS service is blocked, some sites will be affected. The blog theme refers to the font in the Google Font Library (fonts.googleapis.com), causing the site to open super slow, in the domestic use of Google to provide a large number of network services are relatively slow, it is recommended best not to use.
Always load the "fonts.googleapis.com" solution