Skip to content

Instantly share code, notes, and snippets.

@nigelheap
Created August 2, 2019 06:50
Show Gist options
  • Save nigelheap/ddb0f808b5555de333f1bcdcb4de731b to your computer and use it in GitHub Desktop.
Save nigelheap/ddb0f808b5555de333f1bcdcb4de731b to your computer and use it in GitHub Desktop.
Disable wordpress site health just in case your boss sees it and gets lost down a rabbit hole of pointlessness
<?php
// disable the admin menu
add_action( 'admin_menu', function() {
remove_submenu_page( 'tools.php', 'site-health.php' );
});
// block site health page screen
add_action( 'current_screen', function() {
if ( is_admin() ) {
$screen = get_current_screen();
// if screen id is site health
if ( 'site-health' == $screen->id ) {
wp_redirect( admin_url() );
exit;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment