First time trying to use the password protected v开发者_如何学运维isibility option on a Wordpress page, and it seems to do nothing. After adding a password, if I view the page it never asks for a password. Different browsers, clearing out all temporary files, logging out of wordpress admin, nothing makes a difference. Even logged into a remote computer that had never been to the site or admin and opened the page without any prompt for a password. Has anyone else ran into this issue? My Google skills are failing me.
Ended up discovering that the template needed the content() function in it for the password prompt to appear. For those that are in my situation and need to password protect content or PHP scripts in a whole template, this works http://wordpress.org/support/topic/346373
Seems like the theme has to support this functionality. I found out that you have to use something like this to make it work
<?php
if (post_password_required()) {
echo get_the_password_form();
} else {
echo "<p>Protected content</p>";
}
?>
精彩评论