If I create a post and set the visibility to “password protected”, it still shows up on the front page and in the feeds. Is it possible to hide posts from general view altogether, but still allow quick access to some people without creating an account for them?
(This is in WP 3.0.4)
Both the
the_content()
and thethe_excerpt()
template tags already account for password-protected posts, via thepost_password_required()
conditional. If you need to output content, or comments, etc. outside ofthe_content()
/the_excerpt()
, call thepost_password_required()
conditional directly.For example, if you don’t want the comments template to be output if the post is password-protected. you could do the following:
Or, if you don’t want to display the post at all if it is password-protected, you could do something like this, inside the Loop:
My very simple solution is to put something like this in your loop:
This just skip the password protected entry.