利用代码禁止wordpress加载谷歌字体

很文博客hinven.com 网站技术评论93字数 558阅读模式
广告也精彩

最近发现登录Wordpress后台异常缓慢,经常卡在fonts.googleapis.com,这是由于Wordpress后台外链加载了谷歌字体(代码位置在wordpress\wp-includes\script-loader.php第580行),而谷歌服务器大家都知道的原因国内访问困难,严重影响页面加载速度。

利用代码禁止wordpress加载谷歌字体
解决办法:文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/54090.html

将下面代码添加到主题functions.php文件中:文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/54090.html

  1. function coolwp_remove_open_sans_from_wp_core() {
  2.     wp_deregister_style( 'open-sans' );
  3.     wp_register_style( 'open-sans', false );
  4.     wp_enqueue_style('open-sans','');
  5. }
  6. add_action( 'init', 'coolwp_remove_open_sans_from_wp_core' );

之后,再次登录后台速度明显提升。文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/54090.html

代码取自 Remove  Open Sans font from WP core 插件,也可以直接安装启用该插件。文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/54090.html

相似功能的插件:Disable Google Fonts文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/54090.html

因Google字库中只有英文,对国人无任何用处,换用国内某字体服务的方法同样意义不大,禁掉最实用。文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/54090.html 文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/54090.html

工具:作品在线观看

女优:最新作品观看

中文:国语在线观看

weinxin
我的微信
扫一扫更精彩
大家的支持是我更新的动力!!!
 
广告也精彩
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证