This topic has 4 replies, 2 voices, and was last updated 8 years by Radu.

  • Author
  • #115454
     monkeytoldme
    Participant

    Hello,

    I am using the Kleo theme and have the home-register demo page set-up on my website for users to register and log in. For the last 4 days I have been trying to find codes / plugins which will re-direct all logged out users to /home-register so that way only logged in users can view the website.

    Absolutely everything i’ve tried hasn’t worked.

    I believe this may be a theme problem because lots of the codes I have tried create a “too many redirects error”. Here is the most recent code I tried which creates a redirection error:

    COPY CODE
    function wpsites_redirect_login_page() {
        if ( ! is_user_logged_in() ) {
            wp_redirect( 'http://mywebsite.com/home-register' );
            exit();
        }
    }
    add_action( 'template_redirect', 'wpsites_redirect_login_page
    
    
    

     

    #115700
     Radu
    Moderator

    Hi,

    The snippet is ok

    Make sure that you have default wordpress redirect option in wp-admin -> theme options -> miscellaneous -> Login redirect for Popup*

    Let me know

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #115847
     monkeytoldme
    Participant
    This reply has been set as private.
    #115860
     monkeytoldme
    Participant

    I figured this out, you can close the thread, thanks.

    #115938
     Radu
    Moderator

    Great

    Have a nice week

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?