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:

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?

1 Answer
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.

Leave a Reply

Your email address will not be published. Required fields are marked *