最近越来越多朋友询问,为什么 WordPress 后台突然变慢了很多。究其原因,还是国内“网络长城”这道墙搞的鬼 —— 屏蔽了N多Google的IP——导致WordPress后台无法正常加载 Google Open Sans 字体。话说现在,倡萌在家里上网,居然连Google搜索都无法正常使用了,实在郁闷!这可恶的墙!!

从图中看出,不仅仅 Google 字体,就连 Google 地图也是无法加载的(可能你的某些插件会调用google地图api)。其实在《处理部分WordPress核心代码或功能,让你的网站更快》一文中已经提到了这个问题,也提供了解决方法,鉴于不断提问,还是独立文章说明一下。
解决方法很简单,安装启用 Disable Google Fonts 或者 Remove Open Sans font Link from WP core 其中之一即可。或者如果你没有使用WP自带的官方主题,那你添加下面的代码到当前所用的主题的 functions.php 中即可:
/**
* WordPress 后台禁用Google Open Sans字体,加速网站
* https://www.wpdaxue.com/disable-google-fonts.html
*/
add_filter( 'gettext_with_context', 'wpdx_disable_open_sans', 888, 4 );
function wpdx_disable_open_sans( $translations, $text, $context, $domain ) {
if ( 'Open Sans font: on or off' == $context && 'on' == $text ) {
$translations = 'off';
}
return $translations;
} |
/**
* WordPress 后台禁用Google Open Sans字体,加速网站
* https://www.wpdaxue.com/disable-google-fonts.html
*/
add_filter( 'gettext_with_context', 'wpdx_disable_open_sans', 888, 4 );
function wpdx_disable_open_sans( $translations, $text, $context, $domain ) {
if ( 'Open Sans font: on or off' == $context && 'on' == $text ) {
$translations = 'off';
}
return $translations;
}
如果你想继续使用Open Sans 字体,请移步 将WordPress后台的open-sans字体加载源从Google Fonts换为360 CDN
来源:
https://www.wpdaxue.com/disable-google-fonts.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_32399.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57