post_password_expires
Filter HookDescription
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.Hook Information
File Location |
wp-login.php
View on GitHub
|
Hook Type | Filter |
Line Number | 787 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$expires
|
The expiry time, as passed to setcookie(). |
Usage Examples
Basic Usage
<?php
// Hook into post_password_expires
add_filter('post_password_expires', 'my_custom_filter', 10, 1);
function my_custom_filter($expires) {
// Your custom filtering logic here
return $expires;
}
Source Code Context
wp-login.php:787
- How this hook is used in WordPress core
<?php
782 *
783 * @since 3.7.0
784 *
785 * @param int $expires The expiry time, as passed to setcookie().
786 */
787 $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
788
789 if ( $redirect_to ) {
790 $secure = ( 'https' === parse_url( $redirect_to, PHP_URL_SCHEME ) );
791 } else {
792 $secure = false;
PHP Documentation
<?php
/**
* 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.
*
* @since 3.7.0
*
* @param int $expires The expiry time, as passed to setcookie().
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-login.php
Related Hooks
Related hooks will be displayed here in future updates.