Skip to content

Instantly share code, notes, and snippets.

@flistefliste
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flistefliste/daab850404b670840cf9 to your computer and use it in GitHub Desktop.
Save flistefliste/daab850404b670840cf9 to your computer and use it in GitHub Desktop.
Function is_shop_manager() for WooCommerce
<?php
// function is shop manager
function is_shop_manager() {
global $current_user;
$user = wp_get_current_user();
if ( isset( $user->roles[0] ) && $user->roles[0] == 'shop_manager' ) {
return true; // when user is shop manager
} else {
return false; // when user is not shop manager
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment