The get user role get_current_user_role function, and the metatest_init function checks the user's role on the "Administrator" and creates meta tags. But something is not working here .... Help me figure out what
add_action('add_meta_boxes', 'metatest_init'); function metatest_init() { $current_user_role = get_current_user_role( $user ); if ($current_user_role == 'Administrator') { add_meta_box('metatest', 'MetaTest-параметры поста', 'metatest_showup', 'post', 'side', 'high', 'default'); }; } function get_current_user_role( $current_user ) { global $wp_roles; $roles = $current_user->roles; $role = array_shift( $roles ); return $wp_roles->role_names[$role]; }