Support » Developing with WordPress » wp_loginout problem

  • Resolved proxxximity


    I have a static start page on the site that has a login form. In the footer I have added the wp_loginout function with a redirect to the start page and so far it works as I expect, I get redirected back to the start page with my custom login area when i log out. But if i then click the wp_loginout link again, it sends me to the standard wordpress login page. What am I missing. Shouldn’t the redirect be the same that time? I want to always be redirected to my main static startpage when the link is clicked.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    The function always leads to the default login when the user is not yet logged in. The redirect is what to do after login, not how to get there to start with. I’m unsure how it would normally lead to your start page when a user is not logged in. It is not the redirect argument doing that.

    I suggest you manage your own links based on the result of is_user_logged_in(). There’s an example on the Codex Customizing the Login Form that does just that. Modify it to suit your needs. One good modification is to set the “redirect” argument to the “referer” page if it’s from your site so the user clicking the link in the footer is returned to where they were after login.

Viewing 1 replies (of 1 total)
  • The topic ‘wp_loginout problem’ is closed to new replies.