25% off ProSNIPC25OFF

Extend Login Session Duration

Increases the WordPress authentication cookie lifetime to 30 days for a normal session and one year when "Remember Me" is checked.

PHPby SnipCraft
php
<?php
if ( ! function_exists( 'scseed_extend_auth_cookie_expiration' ) ) {
    function scseed_extend_auth_cookie_expiration( $length, $user_id, $remember ) {
        return $remember ? YEAR_IN_SECONDS : 30 * DAY_IN_SECONDS;
    }
    add_filter( 'auth_cookie_expiration', 'scseed_extend_auth_cookie_expiration', 10, 3 );
}
#cookies#login#session#users