Get users by rôle in a list
Get users by rôle in a list
Get users by rôle in a list
function redirect_non_vendors() { global $wp; $user = wp_get_current_user(); $role_needed = ‘vendor’; $page_to_check = ‘secret/page/url’; $redirect_url = home_url( ‘/go-here/’ ); if ( ! in_array( $role_needed, (array) $user->roles ) && $page_to_check === $wp->request ) { wp_redirect( $redirect_url ); exit; } } add_action( ‘template_redirect’, ‘redirect_non_vendors’ ); You’ll want to replace three things here: vendor: the role that someone … Read more
How to assign a custom gender to a user role?
Actually WordPress has ability to prevent user access without acceptation. You should uncheck “Anyone can register” on the /wp-admin/options-general.php
User role can’t be set
Front-end ajax problem all users and guests getting a 302 redirect when accessing wp-admin/admin-ajax.php
Show only users with the same role in Dashboard user list
$user = wp_get_current_user(); if (!current_user_can(‘activate_plugins’)) { add_action(‘admin_head’, ‘removeCategories’, 100); function removeCategories() { echo “<style>#product_cat-23{display: none !important;}</style>”; } } It’s admin_head for admin UI.
Extend user search in the users.php page to allow for searching by role and excluding specified email domains from the “users search” input box
Remove default wordpress roles