Snippet to bypass multiple logins control
-
In the code snippet you give in the FAQ, to bypass multiple login control for administator ou editor profiles :
function loggedin_bypass_roles( $prevent, $user_id ) {
// Array of roles to bypass.
$allowed_roles = array( ‘administrator’, ‘editor’ );
$user = get_user_by( ‘id’, $user_id );
$roles = ! empty( $user->roles ) ? $user->roles : array();
return ! empty( array_intersect( $roles, $whitelist ) );
}
add_filter( ‘loggedin_bypass’, ‘loggedin_bypass_roles’, 10, 2 );
I guess there is an error on this line :
return ! empty( array_intersect( $roles, $whitelist ) );
that should be :
return ! empty( array_intersect( $roles, $allowed_roles ) );The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.