Skip to content

Instantly share code, notes, and snippets.

@theperfectwill
Created January 30, 2023 16:02
Show Gist options
  • Save theperfectwill/16e2ec79662627e81b172aa0ee15d22b to your computer and use it in GitHub Desktop.
Save theperfectwill/16e2ec79662627e81b172aa0ee15d22b to your computer and use it in GitHub Desktop.
WP - Disable Site Health Altogether
<?php
// Plugin Name: wpDisableSiteHealth
// Create our namespace and define whether Wordpress is running or not
namespace wpDisableSiteHealth;
defined('ABSPATH') or exit;
if (!is_blog_installed()) return;
// Toggle on or off switch
// return;
// Breakdance on this metabox, BRO
add_action( 'wp_dashboard_setup', __NAMESPACE__.'\removeMetabox' );
function removeMetabox() {
global $wp_meta_boxes;
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_site_health'] );
}
// Cha cha this menu out of here!
add_action( 'admin_menu', __NAMESPACE__.'\removeMenuItem', PHP_INT_MAX );
function removeMenuItem() {
$page = remove_submenu_page( 'tools.php', 'site-health.php' );
}
// Line step these security tests!
add_filter( 'site_status_tests', __NAMESPACE__.'\disableTests', PHP_INT_MAX );
function disableTests( $tests ) {
unset( $tests['async']['background_updates'] );
return $tests;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment