admin管理员组

文章数量:1122826

I'm removing the default metaboxes like so:

function rh_remove_dashboard_widgets(){
    remove_meta_box('dashboard_activity', 'dashboard', 'normal'); 
    remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); 
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
    remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); 
    remove_meta_box('dashboard_plugins', 'dashboard', 'normal');
    remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
    remove_meta_box('dashboard_primary', 'dashboard', 'side');
    remove_meta_box('dashboard_secondary', 'dashboard', 'side');
}
add_action('wp_dashboard_setup', 'rh_remove_dashboard_widgets');

With all the metaboxes removed, there's the default text 'Add boxes from the Screen Options menu'.

Is there a way to remove these?

I'm removing the default metaboxes like so:

function rh_remove_dashboard_widgets(){
    remove_meta_box('dashboard_activity', 'dashboard', 'normal'); 
    remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); 
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
    remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); 
    remove_meta_box('dashboard_plugins', 'dashboard', 'normal');
    remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
    remove_meta_box('dashboard_primary', 'dashboard', 'side');
    remove_meta_box('dashboard_secondary', 'dashboard', 'side');
}
add_action('wp_dashboard_setup', 'rh_remove_dashboard_widgets');

With all the metaboxes removed, there's the default text 'Add boxes from the Screen Options menu'.

Is there a way to remove these?

Share Improve this question asked Apr 2, 2023 at 3:30 RyanRyan 631 silver badge7 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

On https://wordpress.org/support/topic/remove-add-boxes-from-the-screen-options-menu/, I found this CSS that fixed the issue for me:

#dashboard-widgets .postbox-container .empty-container {
    display: none;
}

To add custom css to /wp-admin area without plugins:

function custom_css() {
  echo '<style>
#dashboard-widgets .postbox-container .empty-container {
    display: none;
}
  </style>';
}
add_action('admin_head', 'custom_css');

本文标签: Is there a way to remove the Add boxes from the Screen Options menu metabox