1

Is there anyway of checking if a password protected post is visible / not visible? I want some thing that says this;

If the post is password protected (that parts fine) and the correct password hasn't been entered, then show 'XXX', else show 'ZZZ'.

1 Answer 1

5

post_password_required(): whether post requires password and correct password has been provided.

<?php
if ( post_password_required() ) {
     echo 'xxx';
} else {
     echo 'zzz';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.