Created
August 2, 2019 06:50
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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