3

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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