Created
November 4, 2016 05:31
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I used this to remove it for everyone (removed the outer IF) since it was a very slow query in my setup.