Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: post_password_expires

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
509            * Filters the life span of the post password cookie.
510            *
511            * By default, the cookie expires 10 days from creation. To turn this
512            * into a session cookie, return 0.
513            *
514            * @since 3.7.0
515            *
516            * @param int $expires The expiry time, as passed to setcookie().
517            */
518           $expire  = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
519           $referer = wp_get_referer();
520           if ( $referer ) {
521                $secure = ( 'https' === parse_url( $referer, PHP_URL_SCHEME ) );
522           } else {
523                $secure = false;
524           }
525           setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
526
527           wp_safe_redirect( wp_get_referer() );