Support » Plugins » Hacks » Edit wp_logout_url() to match new login location

  • Resolved rmoledo

    (@rmoledo)


    Hello,

    I have moved the wp-login.php to a new folder /secret/index.php in order to hide the default login URL. The login, register and lost password forms are working just fine but I have a problem with the logout url.
    How can I edit wp_logout_url() so that it outputs example.com/secret/?loggedout=true instead of example.com/wp-login.php?loggedout=true ?

    Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • C W (VYSO)

    (@cyril-washbrook)

    Per the Codex, wp_logout_url() (function reference) accepts a $redirect parameter. You can use that to specify the URL to which the user should be redirected.

    For future reference, the best place to post support requests like this is the How-To and Troubleshooting forum. The Plugins and Hacks forum is for queries relating to plugins or core hacking.

    Thread Starter rmoledo

    (@rmoledo)

    Yes, I’m already using that parameter and it works fine. But I want to customize the logout url itself.

    C W (VYSO)

    (@cyril-washbrook)

    You may need to rephrase your query to make it clearer what you want to achieve.

    Your stated query was that you want wp_logout_url() to “output” a particular URL. I take that to mean that you want a user to be taken to a particular URL when they log out. The answer to that query is to set the desired URL using the $redirect parameter in wp_logout_url().

    If your query is something else, then you may need to be more specific.

    Thread Starter rmoledo

    (@rmoledo)

    My query is:
    How can I edit wp_logout_url() so that it outputs example.com/secret/?loggedout=true instead of example.com/wp-login.php?loggedout=true ?

    Moderator bcworkz

    (@bcworkz)

    Hook the ‘logout_url’ filter. Whatever you return from your filter callback will be what is returned by any call to wp_logout_url().

    Thread Starter rmoledo

    (@rmoledo)

    Thanks bcworkz!
    If someone else needs it for future reference, it’s documented here.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Edit wp_logout_url() to match new login location’ is closed to new replies.