i want know if shop_manager logged-in wp/woocommerce. know function is_admin(), know way use 'is_shop_manager()' ?
thanks
no, there not direct inbuilt function shop_manager role coming woocommerce & not wordpress, can achieved following code:
function is_shop_manager() { $user = wp_get_current_user(); if ( isset( $user['roles'][0] ) && $user['roles'][0] == 'shop_manager' ) { return true; // when user shop manager } else { return false; // when user not shop manager } } if ( is_shop_manager() ) { // write code shop_manager here }
hope useful.
Comments
Post a Comment