Never needed to change the standard (2 week) login cookie expiration time of WordPress? Here the 3 line of code you need.

add_filter('auth_cookie_expiration', function () {
  return 365 * 2 * DAY_IN_SECONDS;
});

You can add those line in the functions.php file of your theme. DAY_IN_SECONDS is a constant defined by WordPress and represents the number of seconds in a day (86400). In the example above the expiration time was set to 2 years (just an example).

Similar Posts

Leave a Reply