Googleapis与Gravatar这么好的网络资源一到国内就烂成渣渣,严重拖慢影响WordPress的运行速度;很多WordPress主题模板内都引用了Googleapis与Gravatar资源,所以必须禁用掉它或者用别的方案中转加速;
今天分享一个Linux命令Grep来快速查找WordPress主题中哪些地方引用了Googleapis与Gravatar方便快速定位从而进行编辑;
Grep查找命令:
cd命令切换到主题目录下,例如:/home/wwwroot/www.5yun.org/wp-content/themes/blackoot-lite
grep -rn "googleapis"
然后就会返回信息告诉你哪个文件引用了google字体,代码在多少行
[root@VM_0_2_centos blackoot-lite]# pwd
/home/wwwroot/www.5yun.org/wp-content/themes/blackoot-lite
[root@VM_0_2_centos blackoot-lite]# grep -rn "googleapis"
functions.php:160: wp_enqueue_style( 'blackoot-webfonts', '//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700|Quicksand:400italic,700italic,400,700&subset=latin,latin-ext', array(), null );
根据返回信息得知functions.php文件中的160行代码处引用了谷歌字体;
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END