Sets the recovery mode cookie.
Description
This must be immediately followed by exiting the request.
Source
public function set_cookie() {
$value = $this->generate_cookie();
/**
* Filters the length of time a Recovery Mode cookie is valid for.
*
* @since 5.2.0
*
* @param int $length Length in seconds.
*/
$length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS );
$expire = time() + $length;
setcookie( RECOVERY_MODE_COOKIE, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true );
if ( COOKIEPATH !== SITECOOKIEPATH ) {
setcookie( RECOVERY_MODE_COOKIE, $value, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl(), true );
}
}
Hooks
- apply_filters( ‘recovery_mode_cookie_length’,
int $length ) Filters the length of time a Recovery Mode cookie is valid for.
Changelog
Version | Description |
---|---|
5.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.