每次进入后台是不是会有一种杂乱的感觉,模块多,只能在顶部的显示选项设置模块,如果能用代码解决会方便很多,然而网上大多数代码虽然能用,但都是互相转载的,在最新版的wordpress的中,站点健康那个模块还是在的,所以这里就改进了一下代码,可以把站点健康状态也移除了。
function example_remove_dashboard_widgets() { global $wp_meta_boxes; unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_site_health']); } add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets'); remove_action('welcome_panel', 'wp_welcome_panel'); function remove_dashboard_meta() { remove_meta_box('dashboard_activity', 'dashboard', 'normal'); } add_action('admin_init', 'remove_dashboard_meta');