WordPress优化提速

第一、取消谷歌Open sans字体加载

下载安装激活这个插件”Disable Google Fonts”,或

function wp_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’, ‘wp_remove_open_sans_from_wp_core’ );

第二、清除不必要的头部加载:脚本添加到FUNCTION.PHP(当前主题下)文件中

remove_action( ‘wp_head’, ‘feed_links_extra’, 3 ); //去除评论feed
remove_action( ‘wp_head’, ‘feed_links’, 2 ); //去除文章feed
remove_action( ‘wp_head’, ‘rsd_link’ ); //针对Blog的远程离线编辑器接口
remove_action( ‘wp_head’, ‘wlwmanifest_link’ ); //Windows Live Writer接口
remove_action( ‘wp_head’, ‘index_rel_link’ ); //移除当前页面的索引
remove_action( ‘wp_head’, ‘parent_post_rel_link’, 10, 0 ); //移除后面文章的url
remove_action( ‘wp_head’, ‘start_post_rel_link’, 10, 0 ); //移除最开始文章的url
remove_action( ‘wp_head’, ‘wp_shortlink_wp_head’, 10, 0 );//自动生成的短链接
remove_action( ‘wp_head’, ‘adjacent_posts_rel_link’, 10, 0 ); ///移除相邻文章的url
remove_action( ‘wp_head’, ‘wp_generator’ ); // 移除版本号

第三、删除不必要的插件

第四、是否使用商业化主题
绚丽效果需要用到很多JS和CSS,甚至还嵌入前端框架
第五、数据库缓存文件负担

我们需要删除修订版本,不让修订版本添加到数据中心

wp-config.php文件中添加  define(‘WP_POST_REVISIONS‘, false);  代码。

第六、检查是否有垃圾评论

第七、优化图片缓存