Skip to content

Instantly share code, notes, and snippets.

@DevWael
Created June 17, 2019 10:09
Show Gist options
  • Save DevWael/918f8f91a51bbb280ce4f844261aafea to your computer and use it in GitHub Desktop.
Save DevWael/918f8f91a51bbb280ce4f844261aafea to your computer and use it in GitHub Desktop.
Log users with only (Username) In WordPress (Login without PASSWORD!!)
<?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