Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Created January 21, 2020 15:44
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 wpscholar/532907b827dd885a312618dfc6fa937d to your computer and use it in GitHub Desktop.
Save wpscholar/532907b827dd885a312618dfc6fa937d to your computer and use it in GitHub Desktop.
By default, WordPress will log you out when you close your browser. If you check 'Remember Me' WordPress will keep you logged in for 2 weeks. Your web browser stores a cookie that WordPress checks to see if you are logged in. It is possible to set the expiration for that cookie for longer than 2 weeks when a user checks the 'Remember Me' option.…
<?php
add_filter( 'auth_cookie_expiration', function() {
return 31556926; // 1 year in seconds
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment