WP模板阁数千套各行业Wordpress模板随你选,总有一款适合你的网站![收藏本站] 注册 登录

WordPress网站很慢,打开要4、5秒怎么加速

        发布:WP模板阁 类型:wordpress教程 浏览:1,751 次

有些新手使用Wordpress建网站,安装了WordPress模板后,觉得网站后台打开速度很慢,有时需要4、5秒才能转开,这该怎么加速呢?下面WP模板阁介绍一下Wordpress网站后台加速的方法。

方法很简单,只需要一个代码就可以加速成功。

将以下的代码粘贴到自己使用的模板的函数文件functions.php里,然后保存即可。


function duoshuo_avatar($avatar) {
$avatar = str_replace(array("http://www.gravatar.com","http://0.gravatar.com","http://1.gravatar.com","http://2.gravatar.com","http://secure.gravatar.com","https://www.gravatar.com","https://0.gravatar.com","https://1.gravatar.com","https://2.gravatar.com","https://secure.gravatar.com"),get_template_directory_uri().'/xy.gif?wt=',$avatar);
return $avatar;
}
add_filter( 'get_avatar', 'duoshuo_avatar', 10, 3 );
function coolwp_remove_open_sans_from_wp_core() {
wp_deregister_style( 'open-sans' );
wp_register_style( 'open-sans', false );
wp_enqueue_style('open-sans','');
}
add_action( 'init', 'coolwp_remove_open_sans_from_wp_core' );

然后做一个小图片xy.gif,上传到你的模板文件夹下,用于替换WP程序默认的图片。