最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

admin menu - Disable new Site Health screen safely?

programmeradmin2浏览0评论

With WP 5.2 now shipping with the "Site Health" page, I'd like to be able to disable this feature -- it shows way too much about the server info.

To remove it from the menu I'm using:

function escode_remove_site_health_feature() {

    remove_submenu_page( 'tools.php', 'site-health.php' );
}

add_action( 'admin_menu', 'escode_remove_site_health_feature' );

This works well for removing the page from the admin menu. Now I'd like to disable access to the actual page.

My initial go-to was to check if ('site-health' === $screen->id), and then redirect that to the homepage. It feels a bit hacky though -- is there a more professional approach?

With WP 5.2 now shipping with the "Site Health" page, I'd like to be able to disable this feature -- it shows way too much about the server info.

To remove it from the menu I'm using:

function escode_remove_site_health_feature() {

    remove_submenu_page( 'tools.php', 'site-health.php' );
}

add_action( 'admin_menu', 'escode_remove_site_health_feature' );

This works well for removing the page from the admin menu. Now I'd like to disable access to the actual page.

My initial go-to was to check if ('site-health' === $screen->id), and then redirect that to the homepage. It feels a bit hacky though -- is there a more professional approach?

Share Improve this question asked Jun 10, 2019 at 20:59 Best Dev TutorialsBest Dev Tutorials 4451 gold badge7 silver badges21 bronze badges 1
  • You could use the .htaccess file to deny access to that URL, or to redirect it to the homepage, etc. – Sally CJ Commented Jun 11, 2019 at 3:09
Add a comment  | 

1 Answer 1

Reset to default 1

I'm not sure if this is what you're looking for, but defining WP_DISABLE_FATAL_ERROR_HANDLER to true will disable the site health check entirely according to a post about site health check features in 5.1.

发布评论

评论列表(0)

  1. 暂无评论