How to limit user to login only once per session
This will log a user out of all other sessions before logging in. Essentially ensuring that a user will only be allowed one session at a time. add_filter(‘authenticate’, ‘wpse_12282015_single_login_authenticate’, 0, 3); function wpse_12282015_single_login_authenticate($user, $username, $password) { $user = get_user_by(‘login’, $username); if( isset($user->ID) ){ if(isset($user->roles) && is_array($user->roles)) { //check for admins if(in_array(‘administrator’, $user->roles)) { // admin … Read more