由於之前發過一篇 WordPress 禁用谷歌字體的方法, 該方法是用安裝插件!
由於後台插件越多導致網站打開速度慢, 那麼我們能不用插件就儘量別用.
本篇文章黃坤教大家如何不用插件去解決谷歌字體打開緩慢的問題.
1. 首先我們找到你的站點主題的 functions.php 文件, 在 wp-content hemes 你的主題名稱的文件夾裏面
2. 打開 functions.php , 我們會看到首頁第一行的

3. 我們只要在首頁第一行代碼
//禁用 Open Sans
class Disable_Google_Fonts {
public function __construct() {
add_filter( 'gettext_with_context', array( $this, 'disable_open_sans' ), 888, 4 );
}
public function disable_open_sans( $translations, $text, $context, $domain ) {
if ( 'Open Sans font: on or off' == $context && 'on' == $text ) {
$translations = 'off';
}
return $translations;
}
}
$disable_google_fonts = new Disable_Google_Fonts;
如圖:

即可解決 WordPress 谷歌字體問題!