博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
替换WordPress调用的Google前端库为360镜像的库
阅读量:6719 次
发布时间:2019-06-25

本文共 4267 字,大约阅读时间需要 14 分钟。

  hot3.png

把 googleapis 替换成 useso 即可:
sed -i s/googleapis/useso/g `grep -rl googleapis ./wordpress`
另外在后台关闭Gravatar头像显示(设置-讨论-头像显示),免得拖慢页面加载速度.
要成倍提升WordPress速度,可以考虑使用PHP7,参考:
查看哪些文件在哪些行包含了googleapis串:
grep -rn googleapis ./wordpress-4.2
./wp-admin/css/press-this-editor.css:9: url("//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,600,700");
./wp-admin/css/press-this-editor-rtl.css:9: url("//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,600,700");
./wp-includes/script-loader.php:153:    $scripts->add( 'prototype', '//ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');
./wp-includes/script-loader.php:154:    $scripts->add( 'scriptaculous-root', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');
./wp-includes/script-loader.php:155:    $scripts->add( 'scriptaculous-builder', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0');
./wp-includes/script-loader.php:156:    $scripts->add( 'scriptaculous-dragdrop', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');
./wp-includes/script-loader.php:157:    $scripts->add( 'scriptaculous-effects', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0');
./wp-includes/script-loader.php:158:    $scripts->add( 'scriptaculous-slider', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0');
./wp-includes/script-loader.php:159:    $scripts->add( 'scriptaculous-sound', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
./wp-includes/script-loader.php:160:    $scripts->add( 'scriptaculous-controls', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0');
./wp-includes/script-loader.php:650:    $open_sans_font_url = "//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";
./wp-includes/js/tinymce/plugins/compat3x/css/dialog.css:1: url(//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=latin-ext,latin);
./wp-content/themes/twentyfifteen/functions.php:201:        ), '//fonts.googleapis.com/css' );
./wp-content/themes/twentyfifteen/genericons/example.html:6:<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
./wp-content/themes/twentythirteen/functions.php:149:        $fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
./wp-content/themes/twentyfourteen/functions.php:218:        $font_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
可以考虑使用下载到本地的JS文件并且禁用在线字体:
引入字体的地方可以注释掉,变量则置为空.
JS文件则替换为本地文件:
cd wordpress && mkdir ajax
wget \
ajax.useso.com/ajax/libs/prototype/1.7.1.0/prototype.js \
ajax.useso.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js \
ajax.useso.com/ajax/libs/scriptaculous/1.9.0/builder.js \
ajax.useso.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js \
ajax.useso.com/ajax/libs/scriptaculous/1.9.0/effects.js \
ajax.useso.com/ajax/libs/scriptaculous/1.9.0/slider.js \
ajax.useso.com/ajax/libs/scriptaculous/1.9.0/sound.js \
ajax.useso.com/ajax/libs/scriptaculous/1.9.0/controls.js \
ajax.useso.com/ajax/libs/jquery/1.7.2/jquery.min.js
./wp-includes/script-loader.php 里改为:
$scripts->add( 'prototype', '/ajax/prototype.js', array(), '1.7.1');
$scripts->add( 'scriptaculous-root', '/ajax/scriptaculous.js', array('prototype'), '1.9.0');
$scripts->add( 'scriptaculous-builder', '/ajax/builder.js', array('scriptaculous-root'), '1.9.0');
$scripts->add( 'scriptaculous-dragdrop', '/ajax/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');
$scripts->add( 'scriptaculous-effects', '/ajax/effects.js', array('scriptaculous-root'), '1.9.0');
$scripts->add( 'scriptaculous-slider', '/ajax/slider.js', array('scriptaculous-effects'), '1.9.0');
$scripts->add( 'scriptaculous-sound', '/ajax/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
$scripts->add( 'scriptaculous-controls', '/ajax/controls.js', array('scriptaculous-root'), '1.9.0');

转载于:https://my.oschina.net/eechen/blog/406115

你可能感兴趣的文章
NB-IoT来了!网络还差两个月启用,芯片和平台已经准备好了
查看>>
卢东:智能路由,家庭的数据中心
查看>>
智能家庭本周锋闻:小米推智能插座等四件新品,“真智能家居”?
查看>>
C#程序员经常用到的10个实用代码片段
查看>>
WebP支持:超乎你想象
查看>>
XSS与XSSI区别何在?
查看>>
Wink Hub:老牌家居商的智能中控平台
查看>>
云存储时代更好的选择,你的数据由你主宰
查看>>
快速迭代的互联网研发模式下测试如何突破?
查看>>
劫持管理员权限 赛门铁克提醒用户警惕Android勒索软件
查看>>
自家应用都不支持WP系统 微软移动策略让股东怒了
查看>>
如何备份一个国家
查看>>
SDDC架构完全应用?还尚需时日……
查看>>
贵州省大数据发展驶入“信息高速公路”
查看>>
电视监控 选择摄像机技巧
查看>>
停止并重启OpenStack实例的方法
查看>>
PaperWeekly 第35期 | 如何让聊天机器人懂情感
查看>>
为什么各大网站都在启用HTTPS?
查看>>
安防市场增长势头不减 行业竞争日趋激烈
查看>>
美国太阳能光伏安装商对2016年持乐观态度
查看>>