开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜