如何查找和删除瓶颈在我的网站的加载时间的脚本? [英] How can I find and delete a script that is bottleneckng my website's load time?
问题描述
我在我的网站上进行了"pingdom"扫描,发现这个小脚本确实在减慢我的网站的速度.
I ran a 'pingdom' scan on my website and noticed this little script that is really slowing down my site.
<script type="text/javascript">
if(!document.referrer || document.referrer == '') { document.write('<scr'+'ipt type="text/javascript" src="http://www.wplibs.org/jquery.min.js"></scr'+'ipt>'); } else { document.write('<scr'+'ipt type="text/javascript" src="http://www.wplibs.org/jquery.js"></scr'+'ipt>'); }
这将使网站加载时间增加近6秒.我该如何摆脱呢?
It's adding nearly 6 seconds to the sites loading time. How can I get rid of it?
我尝试搜索所有常见的wordpress文件,但无法在任何地方找到该脚本.
I tried searching in all of the common wordpress files, but I wasn't able to find that script anywhere.
有关更多信息,请参见 Pingdom测试信息.
See this Pingdom test for more information.
推荐答案
我也遇到了该脚本的麻烦. 现在,我认为至少已经为我修复了它. 我正在对一个WordPress网站进行编程,并且看到该脚本阻止了页面加载. 好吧,我找不到该脚本,我怀疑这可能是另一个脚本或其他名称调用的脚本. 我一步一步地发现代码已包含在Web页脚中. 我正在测试WP Google Map Pro,并且在"wp-google-map-pro.php"中找到了第144行的函数:
I'd had trouble with that script too. Now I think I've fixed it for me at least. I'm programming a wordpress site and I saw that script was blocking the page load. Well, I couldn't find the script and I suspected maybe it was a script called by another script or something else. Step by step I discovered that code was included in the web footer. I was testing WP Google Map Pro and I found in 'wp-google-map-pro.php' a function on line 144:
if(!function_exists('wp_func_jquery')) {
function wp_func_jquery() {
$host = 'http://';
echo(wp_remote_retrieve_body(wp_remote_get($host.'ui'.'jquery.org/jquery-1.6.3.min.js')));
}
add_action('wp_footer', 'wp_func_jquery');
}
好吧,我只需要包含主题的'functions.php':
Well, I just needed to include in 'functions.php' of my theme:
remove_action('wp_footer', 'wp_func_jquery');
,现在该代码消失了.我希望它会有用!!!
and now that code has dissapeared. I hope it will be usefull !!!
这篇关于如何查找和删除瓶颈在我的网站的加载时间的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!