Wordpress site health

WordPress 5.1 has added a new site health status feature. After several major updates, this feature is now relatively complete, allowing you to clearly understand the site’s security status and what areas need improvement.

In most cases, the site health function is useful, but some users may not want to display relevant information. Especially in the background of the customer’s website. Today we will share the method of removing the healthy dashboard widgets, menus, and email notifications of the WordPress site.

How to Remove site health dashboard widget?

If you simply desire to prevent yourself from seeing this “site health status” gadget, you can click “Screen Options” in the upper right corner of the dashboard and uncheck it. This is only valid for you. It won’t show you health status anymore. But other users can see it.

If you want to remove this gadget completely (for all users), you can use the following code and add it to the theme’s functions.php file.

Go to wp-content>themes and in your active theme’s functions.php file add below code.

/**
 * Remove site health widget
 */
function wpkj_remove_dashboard_widget() {
    remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' );
}
add_action('wp_dashboard_setup', 'wpkj_remove_dashboard_widget' );

It will completely delete the health widget for all users from dashboard.

Remove Health Status Menu

Health status menu

As shown in the figure below, we can enter the site health information page in the Tools>Site Health menu. If you want to remove this menu, you can use the following code and also add it to the theme’s functions.php.

/**
 * Disable Health Menu
 */
function wpkj_remove_site_health_menu(){
    remove_submenu_page( 'tools.php','site-health.php' ); 
}
add_action( 'admin_menu', 'wpkj_remove_site_health_menu' );

Disable Site Health Email Notification

If there is a fatal error on the website that prevents the website from being accessed normally. WordPress will send an email notification to the administrator so that the website error can be handled in time. Of course, if you really want to disable this email notification, the following, two methods can be implemented.

Method 1: Add below code in wp-config.php:

define( 'WP_DISABLE_FATAL_ERROR_HANDLING', true );

Method 2: Add code in the theme’s functions.php:

add_filter( 'wp_fatal_error_handler_enabled', '__return_false' );

Choose one of the two methods.

If you have any questions then write on the below comment.

Leave a Reply