How to password protect wordpress site?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rizwanrajput
    New Member
    • May 2010
    • 13

    #1

    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
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    Wordpress manual shows you how to do this. Have you read it?

    Dan

    Comment

    • Mayur2007
      New Member
      • Aug 2007
      • 67

      #3
      Hello,

      You can make your page / post password protected from the admin panel >> Edit Page/Post then click on visibility Edit link from right sidebar and set restriction and click on ok button.
      Hope your problem will be solved.

      Regards,
      Mayur Bhayani.

      Comment

      • rizwanrajput
        New Member
        • May 2010
        • 13

        #4
        I don't want to do that. I have a website with around 10 pages. I only want to display home page to visitors and rest of the pages should be visible to logged in users only. If a visitor tries to access another page they should be redirected to login page. I just installed a plugin PASSWORD PROTECT PLUGIN FOR WORDPRESS. It is redirecting visitors to login form for all pages including home page. I want to display home page to visitors. This is the code :

        function password_protec ted() {
        if ( (!is_user_logge d_in() and !is_feed()) or (!is_home() and !is_front_page( )) or (!is_user_logge d_in() and is_feed() and !get_option("wp passprotect_pub lic_feed")=="ch ecked")) {
        auth_redirect() ;
        }
        }

        In this code, I added (!is_home() and !is_front_page( )) myself to allow visitors to see home page but it's not working. Am I doing something wrong?

        Comment

        • Mayur2007
          New Member
          • Aug 2007
          • 67

          #5
          Hello rizwanrajput,

          Just try with the following function.

          Code:
          function password_protected() {
          	if(!is_home() or !is_front_page()) {
          		if ( (!is_user_logged_in() and !is_feed()) or (!is_user_logged_in() and is_feed() and !get_option("wppassprotect_public_feed")=="checked ")) {
          		auth_redirect();
          		}
          	}
          }

          Thanks & Regards,
          Mayur Bhayani

          Comment

          Working...