在WordPress主題里,如何去掉Google字體?
網友解答: 我已經使用wordpress建站3年多了,這個問題我也遇到過,不過比較好解決,禁用Google字體可以加快網站打開速度。最簡單的一種禁用方法,就是安裝插件Disable Go
我已經使用wordpress建站3年多了,這個問題我也遇到過,不過比較好解決,禁用Google字體可以加快網站打開速度。
最簡單的一種禁用方法,就是安裝插件Disable Google Fonts,然后進行禁用。進入WP后臺,點擊插件-安裝插件-搜索Disable Google Fonts點擊安裝。安裝后,點擊啟用即可完成,不需要進行其他的設置了。
第二種方法,是修改代碼,以下代碼添加到當前主題functions.php中。
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;
這兩種方法基本就可以了,禁用谷歌字體后,網站打開速度明顯變快。