Remove a plugin meta box from the dashboard

I’m trying to remove the meta box that the Download Manager plugin creates, as it uses a hardcoded http iframe, caused a mixed content error in ssl.

Here is the code that generates the meta box:

Read More
wp_add_dashboard_widget('wpdm_dashboard_widget', 'WordPress Download Manager', 'wpdm_dashboard_widget_function');

and here is the code I’m using in my theme’s functions.php file:

function remove_dashboard_widgets(){
    remove_meta_box('wpdm_dashboard_widget', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');

I also tried ‘dashboard-network’ as the 2nd parameter, as I’m running a multisite setup.
Neither worked for me. Where am I going wrong?

Related posts

1 comment

  1. I found that this works:

    add_action('admin_init', 'rw_remove_dashboard_widgets');
    function rw_remove_dashboard_widgets() {
       remove_meta_box('wpdm_dashboard_widget', 'dashboard', 'normal');
    }
    

    I guess ‘admin_init’ is the key, so that it runs before the dashboard is loaded.

Comments are closed.