apply_filters( 'auth_cookie_expiration', int $length, int $user_id, bool $remember )

Filters the duration of the authentication cookie expiration period.


Description Description


Parameters Parameters

$length

(int) Duration of the expiration period in seconds.

$user_id

(int) User ID.

$remember

(bool) Whether to remember the user login. Default false.


Top ↑

Source Source

File: wp-includes/pluggable.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note content

    An example of how to extend time in your WordPress session by a year, simply enter this code into your `functions.php` or plugin. Other durations have been added to show different times hat can be set.

    add_filter ( 'auth_cookie_expiration', 'wpdev_login_session' );
    
    function wpdev_login_session( $expire ) { // Set login session limit in seconds
        return YEAR_IN_SECONDS;
        // return MONTH_IN_SECONDS;
        // return DAY_IN_SECONDS;
        // return HOUR_IN_SECONDS;
    }
    

You must log in before being able to contribute a note or feedback.