0

The following code has removed some but not all of the widgets from the WP dashboard. I am adding it to my functions file inside my theme. My question is two fold:

1.) What about this is throwing the Use of "undefined constant" errors for remove_dashboard_meta, admin_init and manage_options.

function remove_dashboard_meta() {

remove_meta_box( ‘dashboard_incoming_links’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_plugins’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_primary’, ‘dashboard’, ‘side’ );
remove_meta_box( ‘dashboard_secondary’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_quick_press’, ‘dashboard’, ‘side’ );
remove_meta_box( ‘dashboard_recent_drafts’, ‘dashboard’, ‘side’ );
remove_meta_box( ‘dashboard_recent_comments’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_right_now’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_activity’, ‘dashboard’, ‘normal’);//since 3.8
}
add_action( ‘admin_init’, ‘remove_dashboard_meta’ );

The second question is that the Elementor overview and WPdeveloper feed are still there. What code is going to remove those? This is WP 5.5

2
  • To remove all widgets from dashboard look at this answer:: wordpress.stackexchange.com/a/73562/141970
    – Awais
    Aug 22, 2020 at 1:57
  • Thanks. Is there an option that doesnt prevent any others from being added? Thats what I thought I had above but I am getting those errors and the two residual.
    – Ted
    Aug 22, 2020 at 1:59

1 Answer 1

0

the above example has the wrong comma type probably from copy and pasting. Here is the right type

//Disable Default Dashboard Widgets
function remove_dashboard_meta() {
    remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');
    remove_meta_box('dashboard_plugins', 'dashboard', 'normal');
    remove_meta_box('dashboard_primary', 'dashboard', 'normal');
    remove_meta_box('dashboard_secondary', 'dashboard', 'normal'); 
    remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
    remove_meta_box('dashboard_right_now', 'dashboard', 'normal');
    remove_meta_box('dashboard_activity', 'dashboard', 'normal');
    remove_meta_box('rg_forms_dashboard', 'dashboard', 'normal');
    remove_action('admin_notices', 'update_nag');
}
add_action('admin_init', 'remove_dashboard_meta');

The second answer is that to remove Elementor and its overview you use the following code:

remove_meta_box('e-dashboard-overview', 'dashboard', 'normal');

The Wordpress developers feed widget can be removed with:

remove_meta_box('wpdev_feed_widget', 'dashboard', 'normal');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.