post_password_expires
Filters the life span of the post password cookie.
Description
By default, the cookie expires 10
days from creation. To turn this into a session cookie, return 0.
Parameters (1)
- 0. $time (int) =>
time() + 10 * DAY_IN_SECONDS
- The expiry time, as passed to setcookie(…).
Usage
- To run the hook, copy the example below.
- $time = apply_filters( 'post_password_expires', $time );
- if ( !empty( $time ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the post_password_expires callback
- function filter_post_password_expires( $time ) {
- // make filter magic happen here...
- return $time;
- };
- // add the filter
- add_filter( 'post_password_expires', 'filter_post_password_expires', 10, 1 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'post_password_expires', 'filter_post_password_expires', 10, 1 );
Defined (1)
The filter is defined in the following location(s).
- /wp-login.php
- $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );