• I haven’t found any plugins that redirect all pages except the forgotten password url.

    I’ve been trying to use:

    global $wp;
    $current_url = home_url(add_query_arg(array(),$wp->request));
    if ( !is_user_logged_in() && $current_url !== wp_lostpassword_url() ){
         auth_redirect();
    }

    But then it stops loading the rest of the code.

    I thought return; would continue loading, but I was apparently mistaken.

    What am I doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Can you Please explain more on this? Actually, your requirement is not clear to me.

    Thread Starter brantb15

    (@brantb15)

    I don’t want any of the pages accessible to anyone without a password. The problem with any of login only redirect plugins is that they redirect even the lost password url. I tried adding the code above to my header. The page does allow the redirect to the lost password url, but the content of the page doesn’t load.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Login only redirect’ is closed to new replies.