How to password protect wordpress site?
I need to password protect my wordpress site except home page. I need homepage to be visible to every开发者_开发技巧 visitor but if they click on ANY link that could be post/page within the site then user should be redirected to login page. Any help would be appreciated
<?php
if (is_user_logged_in()){
echo "Welcome, registered user, here are my lovely posts";
}
else {
header( 'Location: http://www.yoursite.com/login.php' ) ;
};
?>
Just a bit of edit to benhowdle89's code..
<?php
if (is_user_logged_in() || is_home()){
echo "Welcome, registered user, here are my lovely posts";
}
else {
header( 'Location: http://www.yoursite.com/wp-login.php' ) ;
};
?>
WordPress › Absolute Privacy « WordPress Plugins
精彩评论