You can disable magic login for a specific user easily by following these steps:
- Navigate user profile
- In their profile settings, find the option labeled “Disable Magic Login for this user.”
- Check the box next to this option to disable magic login for the user.
- Click “Update User” to apply the changes.
By default only users who has “edit_users” capability have access this feature, you can use magic_login_current_user_can_control_user
filter to control capability.
For example, if you want to allow subscriber-level users to disable/enable magic login, you can use this snippet:
function can_current_user_control_magic_login($status) {
$current_user = wp_get_current_user();
return current_user_can('edit_user', $current_user->ID);
}
add_filter('magic_login_current_user_can_control_user', 'can_current_user_control_magic_login');