0

免插件禁用WordPress Site Health(网站健康)检测项

WordPress 5.2 新增 Site Health(网站健康)功能,用于了解当前网站运行中有哪些问题需要改进,位置在WP后台→工具→Site Health,因目前没有WP完整简体中文版,打开后都是英文。

将下面的代码添加到当前主题函数模板 functions.php 中:

function prefix_remove_site_health( $tests ) {
	unset( $tests['direct']['php_version'] );
	unset( $tests['direct']['wordpress_version'] );
	unset( $tests['direct']['plugin_version'] );
	unset( $tests['direct']['theme_version'] );
	unset( $tests['direct']['sql_server'] );
	unset( $tests['direct']['php_extensions'] );
	unset( $tests['direct']['utf8mb4_support'] );
	unset( $tests['direct']['https_status'] );
	unset( $tests['direct']['ssl_support'] );
	unset( $tests['direct']['scheduled_events'] );
	unset( $tests['direct']['http_requests'] );
	unset( $tests['direct']['is_in_debug_mode'] );
	unset( $tests['direct']['dotorg_communication'] );
	unset( $tests['direct']['background_updates'] );
	unset( $tests['direct']['loopback_requests'] );
	unset( $tests['direct']['rest_availability'] );
	return $tests;
}
 
add_filter( 'site_status_tests', 'prefix_remove_site_health' );

检测项全部禁止后,你会看到 Site Health 检测结果显示100%,perfect ! ^-^

完全禁用Site Health 的方法暂时还木有。

欢迎评论