Skip to content

Instantly share code, notes, and snippets.

@RiaanKnoetze
Created November 4, 2016 05:31
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RiaanKnoetze/1532254adbef7a08e0453cf65810dfa2 to your computer and use it in GitHub Desktop.
Save RiaanKnoetze/1532254adbef7a08e0453cf65810dfa2 to your computer and use it in GitHub Desktop.
Remove the WooCommerce Dashboard Status widget in WP Admin for all users that don't have "subscriber" role capabilities.
if (current_user_can('subscriber')) {
function remove_dashboard_widgets() {
// remove WooCommerce Dashboard Status
remove_meta_box( 'woocommerce_dashboard_status', 'dashboard', 'normal');
}
add_action('wp_user_dashboard_setup', 'remove_dashboard_widgets', 20);
add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 20);
} // if
@MarkPraschan
Copy link

MarkPraschan commented Oct 11, 2017

Thanks! I used this to remove it for everyone (removed the outer IF) since it was a very slow query in my setup.

function remove_dashboard_widgets(){
// remove WooCommerce Dashboard Status
remove_meta_box( 'woocommerce_dashboard_status', 'dashboard', 'normal');    
}
add_action('wp_user_dashboard_setup', 'remove_dashboard_widgets', 20);
add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 20);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment