Created
June 17, 2019 10:09
-
-
Save DevWael/918f8f91a51bbb280ce4f844261aafea to your computer and use it in GitHub Desktop.
Log users with only (Username) In WordPress (Login without PASSWORD!!)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//create a function and use the following methods to log the user in without password in wordpress | |
$username = $_POST['username']; | |
$user = get_user_by('login', $username ); | |
wp_clear_auth_cookie(); | |
wp_set_current_user ( $user->ID ); | |
wp_set_auth_cookie ( $user->ID ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment