关于wordpress后台首页加载ajax.googleapis特别慢的解决办法
2024-08-25 22:35:10
通过审查元素发现,拖慢后台加载速度的主要是两个路径
1.https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js
2.http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css
都是谷歌的,现在国内访问谷歌几乎是访问不了,必须要翻墙才可以,下面是解决这两东西的办法
第一种:
通过wordpress后台安装 ‘Disable Google Fonts’ 这个插件,这是最简单的解决办法,网上大多都是用的这个,不过我测试了一下,没有效果,没起效果的接着往下看!
第二种:
1.首先解决prototype.js,找到wp-includes下面的script-loader.php,查找字符串 ‘prototype’
$scripts->add( 'prototype', 'http://cdn.bootcss.com/prototype/1.7.3/prototype.min.js', array(), '1.7.3');
我们换成bootstrap的cdn加速代码
2.解决jquery-ui.css,找到wp-includes下面的functions.php文件,在最下面添加如下代码,思路就是替换
function hc_cdn_callback($buffer) {
return str_replace('ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css', 'cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.min.css', $buffer);//主要是修改这行
}
function hc_buffer_start() {
ob_start("hc_cdn_callback");
}
function izt_buffer_end() {
ob_end_flush();
}
add_action('init', 'hc_buffer_start');
add_action('shutdown', 'hc_buffer_end');
查看你的具体字符串格式,可能需要进行修改一点内容!
有更好的方法还请分享一下,如有错误还请指出,谢谢!
最新文章
- 发测试 HTML/FILE/MYSQL/动态 20151120
- centos7删除已经安装的docker
- Asp.net设计模式笔记之二:应用程序分离与关注点分离
- HttpContext.Current.Cache在控制台下不工作
- BZOJ3928 [Cerc2014] Outer space invaders
- python解无忧公主数学题108
- BZOJ 1641: [Usaco2007 Nov]Cow Hurdles 奶牛跨栏
- CodeForces - 269C Flawed Flow
- ACM2055_ctype.h_cctype
- windows下Eclipse安装Perl插件教程
- 了解一下Http常见状态码、Http协议的工作特点和原理、Http请求Post与Get的区别
- 英文谚语:Take that with a grain of salt
- windows 下配置 Nginx 常见问题
- Ubuntu通过 lshw 工具包查看物理网卡名称
- hdu3191+hdu1688(求最短路和次短路条数,模板)
- 基于Linux的Samba开源共享解决方案测试(六)
- [转帖学习] 使用阿里云证书 升级https
- 01Jenkins环境准备
- [LuoguP1363]幻想迷宫
- Prometheus exporter的Node exporter是可以独立安装,用来测试的
热门文章
- 把angular项目整合到.net mvc中
- java利用反射获取类的属性及类型
- JAVA IO流结构图
- 既然函数也是对象,那么为什么this不指向普通函数?
- [leetcode-495-Teemo Attacking]
- SQL联表查询
- JavaScript学习笔记(三)——留言板知操纵DOM节点
- Python对象类型及其运算
- 004.Create a web app with ASP.NET Core MVC using Visual Studio on Windows --【在 windows上用VS创建mvc web app】
- dict-字典功能介绍