I have redirected all non logged in users to my login page but on the page there is an option for them to register and that navigates back to my login page and I want to exclude that register page from my login page. Can someone please advise?

This is my code:

function admin_redirect() {
    if ( !is_user_logged_in() && !is_page( 12019 )) {
       wp_redirect( home_url('member-login') );
add_action('get_header', 'admin_redirect');
  • If you plan to deal with redirection on page load use the template_redirect event, instead of get_header Nov 17, 2022 at 11:38
  • Is registration a separate page or is it the same page but with a parameter in the URL?
    – nmr
    Nov 17, 2022 at 11:52

1 Answer 1


I think you can use a plugin to do this, I suggest you to use the "User Registration" plugin enter image description here

  • Thank you for your response. Is there maybe a way to do it without a plugin? Nov 17, 2022 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.