Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@soup-bowl
Last active March 27, 2019 21:39
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 soup-bowl/9fe48b278ff754f1b49118724f17adf2 to your computer and use it in GitHub Desktop.
Save soup-bowl/9fe48b278ff754f1b49118724f17adf2 to your computer and use it in GitHub Desktop.
Passwordless Login for WordPress
<?php
include_once(__DIR__."/../wp-load.php");
$usr = get_user_by('ID', 1);
wp_clear_auth_cookie();
wp_set_current_user($usr->ID);
wp_set_auth_cookie($usr->ID);
wp_safe_redirect(user_admin_url());
exit();
@soup-bowl
Copy link
Author

Useful for when a user reports an issue with a specific user account. I can put this on the server and quickly log in to the user's account.

There's plenty out there that are either more efficient or more secure, but as a fire and delete script it does the job. Simply stick on the server, change the ID to the user's account, browse to the script and then delete afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment