WordPress.org

Make WordPress Core

Changeset 25450


Ignore:
Timestamp:
09/16/2013 05:39:30 PM (8 years ago)
Author:
nacin
Message:

Introduce post_password_expires filter to control the expiration of the post password cookie.

props Viper007Bond for initial patch.
fixes #21466.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-login.php

    r25231 r25450  
    315315    $hasher = new PasswordHash( 8, true );
    316316
    317     // 10 days
    318     setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH );
     317    /**
     318     * Filter the life of the post password cookie.
     319     *
     320     * By default, the cookie expires 10 days from now.
     321     * To turn this into a session cookie, return 0.
     322     *
     323     * @since 3.7.0
     324     * @param int $expires The expiry time, as passed to setcookie().
     325     */
     326    $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
     327    setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH );
    319328
    320329    wp_safe_redirect( wp_get_referer() );
Note: See TracChangeset for help on using the changeset viewer.