Why don’t you check if an user is already logged in?
hi @corebreaker,
Not sure what you mean? as an alteration to my existing code?? How would this help us to get to our admin via : https://www.oursite.com/wp-admin/
You know, I’ve just tried you code and it works fine. Let check what should it do.
You have your own account page, where user can log himself in, or log out, or he just see his account page if he’s already logged in. Or, probably, he can register there.
But you’re disappointed, that user can go on wp-login.php and get nasty standard WP form of signing up even when he is logged in. In this case you redirect him on account page, unless there’s no act of logging out. And it works.
But when you’re on the site as an admin you can’t get to admin side through wp-admin, right? But it works in my test site.
Ok almost,
Basically we have a template which allows us to replace the standard WP login form so members can login and not see the basic WP login – that’s what my script does. But in using this script we admins cannot go to the admin backend via the url :
https://www.oursite.com/wp-admin/
This is what i need to do everything else works as expected …
I think your redirect conditions are too restrictive. It’s stopping the normal login redirects from working. Some other actions besides logout should be allowed to go through to wp-login.php. Figure out which actions do not generate output, they would be safe to not redirect.
What might be easier would be to simply add ! is_admin()
to the conditions for redirect. Just a hunch, I’m not sure if it would help.