最近愈來愈多朋友詢問,爲何 WordPress 後臺忽然變慢了不少。究其緣由,仍是國內「網絡長城」這道牆搞的鬼 —— 屏蔽了N多Google的IP——致使WordPress後臺沒法正常加載 Google Open Sans 字體。話說如今,倡萌在家裏上網,竟然連Google搜索都沒法正常使用了,實在鬱悶!這可惡的牆!!php
從圖中看出,不單單 Google 字體,就連 Google 地圖也是沒法加載的(可能你的某些插件會調用google地圖api)。其實在《處理部分WordPress核心代碼或功能,讓你的網站更快》一文中已經提到了這個問題,也提供瞭解決方法,鑑於不斷提問,仍是獨立文章說明一下。html
解決方法很簡單,安裝啓用 Disable Google Fonts 或者 Remove Open Sans font Link from WP core 其中之一便可。或者若是你沒有使用WP自帶的官方主題,那你添加下面的代碼到當前所用的主題的 functions.php 中便可:api
1 2 3 4 5 6 7 8 9 10 11 |
/** * 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網絡