mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
34 lines
607 B
Text
34 lines
607 B
Text
if ( ! defined( 'ABSPATH' ) ) exit;
|
|
|
|
|
|
// disable the admin menu
|
|
|
|
function escode_remove_site_health_menu() {
|
|
|
|
remove_submenu_page( 'tools.php', 'site-health.php' );
|
|
|
|
}
|
|
|
|
add_action( 'admin_menu', 'escode_remove_site_health_menu' );
|
|
|
|
|
|
|
|
// block site health page screen
|
|
|
|
function wp_block_site_health_access() {
|
|
|
|
if ( is_admin() ) {
|
|
|
|
$screen = get_current_screen();
|
|
|
|
// if screen id is site health
|
|
if ( 'site-health' == $screen->id ) {
|
|
wp_redirect( admin_url() );
|
|
exit;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
add_action( 'current_screen', 'wp_block_site_health_access' );
|