Advertisements

post_password_required

Definition:
function post_password_required( $post = null ) {}

Whether post requires password and correct password has been provided.

Parameters

  • int|object $post: An optional post. Global $post used if not provided.

Return values

returns:false if a password is not required or the correct password cookie is present, true otherwise.

Source code

function post_password_required( $post = null ) {

	$post = get_post($post);



	if ( empty($post->post_password) )

		return false;



	if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) )

		return true;



	if ( stripslashes( $_COOKIE['wp-postpass_' . COOKIEHASH] ) != $post->post_password )

		return true;



	return false;

}

2573

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: