Created
October 1, 2021 11:42
-
-
Save jorgemasta/9ffb7d260a16d44c568db1c7e624b956 to your computer and use it in GitHub Desktop.
Authenticate user in WordPress with code
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 | |
// Authenticate wordpress user 1 (ID) | |
wp_set_auth_cookie(1); | |
/** | |
* If doesn't works, try this: | |
wp_clear_auth_cookie(); | |
wp_set_current_user ( 1 ); | |
wp_set_auth_cookie ( 1 ); | |
*/ | |
// Rest of your functions.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment