[Defender] MASK LOGIN AREA – Redirect to admin login after log out by members of site

Dear all,

When I active MASK LOGIN AREA, everything works as well.

I changed the login address to something else but the problem is when my users who login in the website, want to log out, after log out they will see the image which I have attached ( admin login ).

They should redirect to the home page as before.

Is there any solution?

https://imgur.com/aI30uee

https://imgur.com/avITHLi

Thanks in advanced

Best regards

  • Ash
    • WordPress Hacker

    Hello Hadi

    Please try the following code:

    add_filter( 'logout_redirect', function() {
    return site_url();
    }, 999 );

    If it still doesn’t work for you, then try to logout from admin end instead of front end. If it goes in home page but then something changed on the theme.

    To be more sure, please disable defender and do the test again. If the scenario is same, then we can be sure that defender is not interfering.

    Please let us know how it goes. Have a nice day!

    Cheers,

    Ash

    • Hadi
      • WPMU LOVER

      Dear Ash,

      Where should I add this code?

      In function.php in my child theme?

      About this:

      please disable defender and do the test again. If the scenario is the same, then we can be sure that defender is not interfering.

      Do you think I did not try it already?

      Perhaps I tried then I decided to ask a question here.

      If I disable the admin mask area, everything will be fine.

      Best regards.

  • Ash
    • WordPress Hacker

    Hello Hadi

    Where should I add this code?

    In function.php in my child theme?

    Sorry, I should have been more clear.

    You can use this code in your child theme’s functions.php if the theme is not changed. Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    Let us know how it goes. Have a nice day!

    Cheers,

    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.