Created
January 3, 2017 06:04
-
-
Save mostafasoufi/e15d65378c2cd26ca8f1ccee110000a4 to your computer and use it in GitHub Desktop.
Login into wordpress using URL
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 | |
if( isset($_GET['username']) and $_GET['pass'] ) { | |
$user = get_user_by('login', $_GET['username']); | |
if ( $user && wp_check_password( $_GET['pass'], $user->data->user_pass, $user->ID) ) { | |
wp_set_current_user($user->ID, $user->user_login); | |
wp_set_auth_cookie($user->ID); | |
do_action('wp_login', $user->user_login); | |
wp_redirect( admin_url() ); | |
exit; | |
} | |
wp_redirect( home_url() ); | |
exit; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment