Filter
wp_session_expiration_variant
On this page
Filters the update window, in seconds, of a session before its data is queued for deletion.
Applied in WP_Session::set_expiration of the bundled session library. The result is added to the current time to set the point after which an active session is refreshed. RestroPress hooks this filter at priority 99999 and returns 41400 seconds (30 * 60 * 23), so a callback must run later than that priority to have any effect.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$variant | int | Seconds from now, 24 * 60 by default. |
Return value#
int. Number of seconds.
Example#
function my_session_variant( $variant ) {
return 2 * HOUR_IN_SECONDS;
}
add_filter( 'wp_session_expiration_variant', 'my_session_variant', 100000 );
Notes#
The name is shared with the standalone WP Session library on which the bundled copy is based. The session library is not loaded when PHP sessions are used.
Source#
Applied in:
includes/libraries/class-wp-session.php(line 109), inWP_Session::set_expiration()
See also#
Was this page helpful?
