Skip to content

Instantly share code, notes, and snippets.

@mostafasoufi
Created January 3, 2017 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mostafasoufi/e15d65378c2cd26ca8f1ccee110000a4 to your computer and use it in GitHub Desktop.
Save mostafasoufi/e15d65378c2cd26ca8f1ccee110000a4 to your computer and use it in GitHub Desktop.
Login into wordpress using URL
<?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