自從谷歌被牆了,就連谷歌字型也連結不上了,但是 WordPress 後臺和一些外國主題都使用了谷歌字型,谷歌字型連結不上自然就導致了 WordPress 奇慢無比,所以在國內使用 WordPress 做的第一件事就是去掉谷歌字型。
將以下程式碼新增到當前使用的主題的 functions.php 檔案中即可。

程式碼預覽

  1. //去除谷歌字型
  2.     if (!function_exists('remove_wp_open_sans')) :
  3.     function remove_wp_open_sans() {
  4.     wp_deregister_style( 'open-sans' );
  5.     wp_register_style( 'open-sans', false );
  6.     }
  7. 	// 前臺刪除 Google 字型 CSS
  8.     add_action('wp_enqueue_scripts', 'remove_wp_open_sans');
  9. 	// 後臺刪除 Google 字型 CSS
  10.     add_action('admin_enqueue_scripts', 'remove_wp_open_sans');
  11.   endif;