Check logged in user role in WordPress

Check logged in user role. Use function  wp_get_current_user() to get the current/logged in user info. Usage: var_dump( prefix_user_has_role( ‘administrator’ ) ); // Output: // bool(true) Snippet:

Read More »

Get logged in user roles in WordPress

Get logged in user assigned roles. Use function  wp_get_current_user() to get the current/logged in user info. Output: #Output: print_r( prefix_get_current_user_roles() ); // Output: // Array // ( // [0] => administrator // ) Code: #Code:

Read More »
Scroll to Top
%d bloggers like this: