post_password_expires
Filters the life span of the post password cookie.
By default, the cookie expires 10 days from creation. To turn this into a session cookie, return 0.
Usage
add_filter( 'post_password_expires', 'wp_kama_post_password_expires_filter' ); /** * Function for `post_password_expires` filter-hook. * * @param int $expires The expiry time, as passed to setcookie(). * * @return int */ function wp_kama_post_password_expires_filter( $expires ){ // filter... return $expires; }
- $expires(int)
- The expiry time, as passed to setcookie().
Changelog
Since 3.7.0 | Introduced. |
Where the hook is called
In file: /wp-login.php
post_password_expires
wp-login.php 785
$expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );