filtrod 2.8.0
auth_cookie_expiration
Opis
Zmienia czas ważności ciasteczka sesji logowania.
Przykład użycia
add_filter( 'auth_cookie_expiration', ... )php
add_filter( 'auth_cookie_expiration', 'wpdocs_session_length', 10, 3 );
function wpdocs_session_length( $length, $user_id, $remember ) {
return $remember ? 30 * DAY_IN_SECONDS : $length;
}
add_filter( 'auth_cookie_expiration', 'wpdocs_session_length', 10, 3 );
function wpdocs_session_length( $length, $user_id, $remember ) {
return $remember ? 30 * DAY_IN_SECONDS : $length;
}Parametry
| Parametr | Typ | Opis |
|---|---|---|
$length | int | Duration of the expiration period in seconds. |
$user_id | int | User ID. |
$remember | bool | Whether to remember the user login. Default false. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'auth_cookie_expiration', 'twoja_funkcja', 10, 3 );
function twoja_funkcja($param_1, $param_2, $param_3) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'auth_cookie_expiration', 'twoja_funkcja', 10, 3 );
function twoja_funkcja($param_1, $param_2, $param_3) {
// Twój kod
}Popularne w tej kategorii