1、gravatar用户头像
加载的时间长;很多朋友使用的WordPress主题,基本都是使用的gravatar头像,很遗憾的是,目前gravatar基本被墙光了。禁用gravatar头像办法如下:
后台-设置-评论-去掉勾选显示Avatars
参考:https://developer.aliyun.com/article/532834
2.load-scripts.php和 load-styles.php
通过谷歌开发者工具分析是load-scripts.php和 load-styles.php 这两个文件导致后他速度的缓慢。
解决方案就是在wp-config.php文件中加入
define('CONCATENATE_SCRIPTS', false);
保存刷新后台后,速度就快了很多。
参考
https://www.tzwl420.club/493.html
3.google字体
另外谷歌字体导致后台速度慢也是原因之一。可以通过粘贴一下代码到主题function.php中
//禁用谷歌字体
if (!function_exists('remove_wp_open_sans')) :
function remove_wp_open_sans() {
wp_deregister_style( 'open-sans' );
wp_register_style( 'open-sans', false );
}
// 前台删除Google字体CSS
add_action('wp_enqueue_scripts', 'remove_wp_open_sans');
// 后台删除Google字体CSS
add_action('admin_enqueue_scripts', 'remove_wp_open_sans');
endif;
4.How to Disable Emojis in WordPress
插件Disable Emojis
5.WordPress如何移除block-library/style.min.css
WordPress发现有css引入:
wp-includes/css/dist/block-library/style.min.css
但是这个css其实一般用不到,如何移除呢?主题文件functions.php加如下代码即可:
add_action('wp_enqueue_scripts', function () {
wp_dequeue_style('wp-block-library');
});