How to redirect non logged in users to Login page on Wordpress?

后端 未结 4 1013
既然无缘
既然无缘 2020-12-22 06:07

I know this is a question asked million times but I can\'t find an answer that is either fitting the version of Wordpress now and/or my particular case.

I have a Wor

4条回答
  •  不知归路
    2020-12-22 06:40

    Take a look here

    https://wordpress.org/support/topic/how-to-auth_redirect-to-specific-page

    
    

    You can also add this to your functions.php file instead of what I said before:

    function admin_redirect() {
    if ( !is_user_logged_in()) {
       wp_redirect( home_url('/{custom page goes here}/') );
       exit;
    }
    }
    add_action('get_header', 'admin_redirect');
    

提交回复
热议问题