WordPress users roles wp-admin

In WordPress, there is no concept of “super admins” in the same way that there is in a multisite installation. However, there may be users with the “administrator” role who have access to all areas of the site, including the WordPress settings. If you are an administrator and you are unable to access the WordPress … Read more

Display users by role

What I understand from your code: You want to list users with author role. You’re in the right direction, however, following are some tips to make your code better. Use role id in lowercase syntax. Change Author to author for role property. Get the results for once and avoid repeated calls. Save the results like … Read more

WordPress show content if current user get spesific role and spesific meta value

Your question needs some additional context, but here’s a generic approach to what you’ve described. if ( is_user_logged_in() ) { $user = wp_get_current_user(); // Does user have the required role? if ( in_array( ‘some_role’, $user->roles ) && ‘some_meta_value’ == get_user_meta( $user->ID, ‘some_meta’, true ) ) { // Special content… } else { // User doesn’t … Read more

assign roles to users in custom drop down in signup form

You have to set user role using user id. use below code to assign role to user. add below code after this line : $user_id = wp_create_user($firstname,$lastname,$email); set role to new created user. by default it will set subscriber role. $user_id_role = new WP_User($user_id); $user_role = !empty($_POST[‘role’]) ? $_POST[‘role’] : ‘subscriber’; $user_id_role->set_role($user_role); i have tested … Read more