Support » Fixing WordPress » WP 2.7 Can’t Log Out

  • Resolved demonboy


    Just done a search for this and it seems people are having a problem logging in. I can do that ok but I can’t log out! I’m using the comments part of the page to do this, which takes me to the The page title says ‘WordPress Failure Notice’ and the page says “You are attempting to log out of….(blank line). Please try again”.

    I presume the blank line is because I have not filled in the title of my blog (I don’t want the html title link at the top of my page).

    Does anyone have any clues?

Viewing 15 replies - 1 through 15 (of 24 total)
  • Hi there, check how many pages you have open, while logged in, if you have more than one, by logging out of the first page and then trying to log out for a second time, will cause this problem.
    hope you get there.

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

    As subzane has pointed to, it sounds like your theme does not use the nonce in its logout link, which is required for 2.7. So you need to edit the theme.

    That’s the ticket. Ta.

    I’m having this issue also…but don’t understand where I would put this code in my theme.
    Any help would be appreciated!
    (Big Thank You in Advance)

    I’m having the same problem with logout. When clicking the logout link in the upper right corner of the control panel, I get a screen that reads “You are attempting to log out of (website name)”
    Then there’s hypertext that says Please Try Again. That link takes you back to wp-admin. If I place my cursor in the address bar and hit enter, I get a different screen that reads “You are attempting to logout of (website name). Then it reads “Do you really want to logout?” Here ‘logout’ is hyptertext and adds

    This has been my workaround… to just place cursor in address bar, hit enter, then click the hyptertext that says logout.

    This doesn’t appear to have anything to do with my theme as it only calls the wp-login.php script which is nowhere near my theme files.


    I too and suffering from not being able to log out. I just copied comments.php from the classic theme included with the 2.7 drop and placed it into my custom theme and still can’t seem to log out. Do I need to regenerate anything etc….

    thanks in advance


    I have just recently installed a wp theme for one of my sites, I’m also experiencing issues logging out as ADMIN from the front-end screens. I get this url and the following text…

    You are attempting to log out of Alexandra Burke Music
    Please try again.

    I have looked at my “comments.php” and I see this bit of code..

    <p>Logged in as /wp-admin/profile.php”><?php echo $user_identity; ?>. /wp-login.php?action=logout” title=”<?php _e(‘Log out of this account’) ?>”> (Logout) </p>

    Does this look correct to you?

    Any help would be very much appreciated.



    Same problem here. okjedi’s workaround works for me too, but users aren’t going to figure that out. Can someone pop in with some direction for non-technical folks about how to fix this in their themes? What file to edit, what lines to change, what code to put in there?

    Yeah, let me echo what ssflanders said. I’m getting bits and pieces of information, but no idea what to do with it. Somebody please reply with the following information:

    1) What file(s) need to be edited, and where will they be found?

    2) What part of the file needs to be edited, and how should it be edited?

    There are those of us here who are just getting started, and don’t have a freakin’ clue what a nonce is, or where to find it. Treat us as idiots, explain it step-by-step…and help us get this working.


    Another New User Here…

    If subzane (or anyone else) could leave a post here to help direct us as to where to insert the code:

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

    we would greatly appreciate it. Thank you very much!

    Well, I had this same issue because I was using an old theme which used the old form of logout code which 2.7 was no longer accepting. Since all themes are different, there isn’t going to be a single answer to this question. You have to look through the header.php, sidebar.php, comment.php, etc to find anyplace where the logout code might be in your particular theme.

    My old theme happened to have the “Logout” jazz located in the sidebar. It was a safe bet that I’d find the code in the sidebar.php file. I just opened up the sidebar.php page, and searched it for text that said “logout”. I found the following:

    <li><a href="<?php echo get_settings('siteurl') .
    '/wp-login.php?action=logout&amp;redirect_to=' .
     $_SERVER['REQUEST_URI']; ?>"><?php _e('Logout'); ?></a></li>

    The page subzane references above has the updated bit of code. I copied it, and added another line beneath that given above which looked like this:

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

    Then I saved the sidebar.php file loaded up the page. Now I had two logout links, and clicking the one I labeled 2.7 did the trick. So I logged back in, edited the sidebar.php again, removed the first line, and saved.

    I think I have found a possible solution to our logout problem…

    I have found out that WP 2.7 uses (in part) PHP code and not the standard HTML code. Therefore, you will need to download and activate the plugin/widget at this link (this widget accepts both HTML and PHP):

    This is a text widget and acts like a sidebar. Once it has been installed and activated, follow these steps:

    1) Go to your dashboard.

    2) In the “Right Now” box (towards the upper left hand side of your screen), simply click on the word “Widgets” within the section that says “Theme (name of your theme) with (number) Widgets.”

    3) You will now see a list of available widgets. Click “Add” next to the PHP Code widget. You will notice that the PHP Code widget is added to your list of Current Widgets on the right hand side of the screen.

    4) Click on “edit” within the PHP Code box. (for some reason, the edit feature only works within Mozilla Firefox for me, not Internet Explorer).

    5) The box will expand and you can add a title (like LOGOUT) in the upper section of the box.

    6) Now enter your php code in the remaining section of the box. It is here you can insert the famous code that we keep reading about:

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

    7) Click “done” on the lower left hand corner of the PHP Code box.

    8) Click “Save Changes”

    Now, once you visit your blog site (where this widget is inserted) you should be able to logout of WP 2.7 by clicking on the word “Logout”

    Thanks PalabraPress for pointing us to this powerful widget. This will be very useful to render stats and info from other plugins as well using the PHP enabled widget!!

    Works like a champ. I noticed the Logout issue after upgrading to 2.7 and now understand it is related to older themes that needs to have code updates… This code of course needs to be in PHP enabled environment otherwise it will render as HTML text. The PHP executable widget it the way to go if you have made a customized login / registration / logout widget in your sidebar !!!! See here: Working fine now!!

    I tried some of the workarounds, but now I find I can’t log in as anyone except admin. And I can log out of admin no sweat. I can also login with my user account; that’s the one I can’t log out of. But if I log in as another user, the login fails. And it fails even after I reset the other user’s password and attempt to login with the reset password.

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘WP 2.7 Can’t Log Out’ is closed to new replies.