post_password_required [ WordPress Function ]
post_password_required ( $post = null )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: wp_lostpassword_url, the_post_password, wp_set_password, _post_format_request, reset_password
Whether post requires password and correct password has been provided.
Source
<?php
function post_password_required( $post = null ) {
global $wp_hasher;
$post = get_post($post);
if ( empty( $post->post_password ) )
return false;
if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
return true;
if ( empty( $wp_hasher ) ) {
require_once( ABSPATH . 'wp-includes/class-phpass.php');
// By default, use the portable hash from phpass
$wp_hasher = new PasswordHash(8, true);
}
$hash = stripslashes( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
return ! $wp_hasher->CheckPassword( $post->post_password, $hash );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/post password required « WordPress Codex
Description. Whether post requires password and correct password has been provided. Usage. <?php post_password_required( $post ); ?> Parameters ...
codex.wordpress.org - WordPress › Support » post_password_required() not working
Hi all,. I have added custom fields to the Media area of WP to add a password to an attachment (working), but when I enter the password WP is telling me that the ...
wordpress.org - Hide password protected posts - WordPress
Sep 20, 2011 ... if ( ! post_password_required() && ( is_single() || ( is_page() ... if ( post_password_required() ) { return; } else { // Normal Loop Post output goes ...
wordpress.stackexchange.com - post_password_required() WordPress function reference ...
Whether post requires password and correct password has been provided.
queryposts.com