自从谷歌被墙了,就连谷歌字体也链接不上了,但是 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;