Obtain wordpress user role
I wanted the logged in user to get one form from other application only if he/she is Administrator and here is how I checked it. You can check for any role (even new role made through custom user role). <? require($_SERVER[‘DOCUMENT_ROOT’].’/wp-load.php’); //to load from any folder $current_user = wp_get_current_user(); $user_info = get_userdata($current_user->ID); if (in_array(“administrator”, $user_info->roles)) … Read more