wordpress网站后台管理比较慢怎么办
我们只需要将下面的代码进行复制,然后粘贴进去,然后保存就可以了。
首先我们先找到外观,主题文件编辑器

然后找到functions.php,找不到的话直接ctrl+f查找就可以啦,然后找到底部添加下面这些代码:

/*禁用谷歌字体和头像*/function kratos_get_avatar( $avatar ) {$avatar = preg_replace( “/http:\/\/(www|\d).gravatar.com/”,”http://cn.gravatar.com”,$avatar );return $avatar;}add_filter( ‘get_avatar’, ‘kratos_get_avatar’ );
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’ );
// 屏蔽谷歌字体add_filter( ‘gettext_with_context’, ‘wpjam_disable_google_fonts’, 888, 4);function wpjam_disable_google_fonts($translations, $text, $context, $domain ) {$google_fonts_contexts = array(‘Open Sans font: on or off’,’Lato font: on or off’,’Source Sans Pro font: on or off’,’Bitter font: on or off’);if( $text == ‘on’ && in_array($context, $google_fonts_contexts ) ){$translations = ‘off’;}
return $translations;}
//屏幕谷歌的API
// 彻底关闭自动更新add_filter(‘automatic_updater_disabled’, ‘__return_true’);// 关闭更新检查定时作业remove_action(‘init’, ‘wp_schedule_update_checks’);
// 移除已有的版本检查定时作业wp_clear_scheduled_hook(‘wp_version_check’);
// 移除已有的插件更新定时作业wp_clear_scheduled_hook(‘wp_update_plugins’);
// 移除已有的主题更新定时作业wp_clear_scheduled_hook(‘wp_update_themes’);
// 移除已有的自动更新定时作业wp_clear_scheduled_hook(‘wp_maybe_auto_update’);
// 移除后台内核更新检查remove_action( ‘admin_init’, ‘_maybe_update_core’ );
// 移除后台插件更新检查remove_action( ‘load-plugins.php’, ‘wp_update_plugins’ );remove_action( ‘load-update.php’, ‘wp_update_plugins’ );remove_action( ‘load-update-core.php’, ‘wp_update_plugins’ );remove_action( ‘admin_init’, ‘_maybe_update_plugins’ );
// 移除后台主题更新检查remove_action( ‘load-themes.php’, ‘wp_update_themes’ );remove_action( ‘load-update.php’, ‘wp_update_themes’ );remove_action( ‘load-update-core.php’, ‘wp_update_themes’ );remove_action( ‘admin_init’, ‘_maybe_update_themes’ );
// 禁止古腾堡加载 Google 字体add_action(‘admin_print_styles’, function(){wp_deregister_style(‘wp-editor-font’);wp_register_style(‘wp-editor-font’, ”);});
最后一步,代码全部复制完成之后,点击更新文件就可以啦。
