Support » Fixing WordPress » How to create a Logout menu?

  • Wayne Smith


    Hi everyone,
    I’ve created a series of menus for my wordpress site that allow users to login and Recover their passwords, but no matter what I try I can’t seem to create a logout menu that achieves what I need.

    I’ve created a custom Login menu with the following URL:

    A custom lost password menu with the following URL:

    and a custom Logout menu with the following URL:

    They all work fine, except when I click the Logout menu it takes me to an empty white page in my browser window with the words:

    You are attempting to log out of My Web Site
    Do you really want to log out?

    The words ‘log out’ are hyperlinked in order to click and log out of the site, but I really want a user to be instantly logged out when they click the Logout menu and then automatically redirect them back to the home page.

    It doesn’t seem to matter what I enter into the custom menu URL for the Logout link (I’ve tried loads of variations) it either fails to work completely, or I get this white page filling the whole of my browser window first and I don’t know how to stop this from happening.

    Can anyone offer any insight please, I’m pulling my hair out over this!

    Kind Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • jberg1


    I found this option, but is only for hard coding the link in your template:

    <a href="<?php echo wp_logout_url(); ?>" title="Logout">Logout</a>

    This works for WP 2.7+
    But the custom menu won’t allow this in a custom HTTP link.

    Here is something else I found for setting up a function to add a logout/login to your menu. It can be positioned where you want, but it will add it to all custom menus (if you have more than one).

    See this Article

    Wayne Smith


    Hi jberg1,
    I really appreciate you replying to my post, I read through the article that you listed and tried changing a few pieces of code once I had copied it into my functions.php file, after about 30 minutes of playing around and trying different things I’ve now go it working absolutley perfectly – even better than how it was before.

    I’ve been trying to find a solution to this problem for about two weeks now so I just really wanted to say a big thank you for replying to my post.

    You have no idea how much you have eased my headache!

    Kind Regards,

    Wayne, can you please post your solution so others can see it? I’m trying to do the same thing, add a top-level menu item for logging out.


    Looks like someone edited this to allow for easy positioning and assigning to a specific menu.

    Look at this article.



    Try using this http://

    Replace with your site domain name
    Replace URL with the link to where you want to redirect after clicking “Logout”

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to create a Logout menu?’ is closed to new replies.