[resolved] WP 2.7 Can't Log Out (25 posts)

  1. demonboy
    Posted 6 years ago #

    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 http://www.followtheboat.com/wp-login.php?action=logout. 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?

  2. mikey1
    Posted 6 years ago #

    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.

  3. Andreas Norman
    Posted 6 years ago #


    <a href="<?php echo wp_logout_url(); ?>">Logout</a>
  4. mrmist
    Forum Janitor
    Posted 6 years ago #

    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.

  5. demonboy
    Posted 6 years ago #

    That's the ticket. Ta.

  6. itsjeremy
    Posted 6 years ago #

    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)

  7. okjedi
    Posted 6 years ago #

    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 http://www.sitename.com/wp-login.php?action=logout&wpnonce=(numbers)

    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.


  8. PaulRichardson
    Posted 6 years ago #

    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

  9. russellcox
    Posted 6 years ago #


    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 http://www.alexandra-burke-music.com/wp-login.php?action=logout 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.



  10. ssflanders
    Posted 6 years ago #

    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?

  11. thatguyfromchina
    Posted 6 years ago #

    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.


  12. PalabraPress
    Posted 6 years ago #

    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!

  13. in8sworld
    Posted 6 years ago #

    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.

  14. PalabraPress
    Posted 6 years ago #

    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"

  15. zzb
    Posted 6 years ago #

    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: http://zardozz.com/zz/ Working fine now!!

  16. JohnBike
    Posted 6 years ago #

    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.

  17. jeffery2k9
    Posted 6 years ago #

    Hai cool guys,
    I dont know about about wpmu but am using wp 2.7
    and i was having a problem with logout...
    When user clicks on logout its get redireted to the home page but user is still logged

    It displays the msg

    "You Attempting to logout of the siteurl
    Please try again"

    where please try again is a hyperlink and when the user clickc it just redirection to

    the home page occurs without loggingout....

    However I was able resolve this using the following steps...

    1)My logout links comes from a plugin called
    the path to it seems something like


    2)Inside usersidebarpanel there is a file called as

    3)edit this file as follows

    In this page somewhere about lines 61,93,100
    there is a piece of code as given below

    echo '

  18. <a


    'siteurl').'" title="'.$usp_language['logout'].'"


  19. ';

    4)Replace This code with the following code given below

    echo '

  20. <a href="'.wp_logout_url(get_permalink()).'"

    title="'.$usp_language['logout'].'" >'.$usp_language['logout'].'

  21. ';

    5)Thats it and check out...

  22. rodriguex
    Posted 6 years ago #

    Here's what worked for me, I looked at the comments template of my theme (comments.php) and found:

    <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>

    Which I replaced with (as subzane and mrmist pointed out):

    <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(); ?>" title="Log out of this account">Logout &raquo;</a></p>

    I saved the changes and it worked.

  23. hakuri
    Posted 6 years ago #

    Edited out -- new post below.

  24. hakuri
    Posted 6 years ago #

    I  cannot find a way to make this work! I also cannot logout of my blog, nor allow my users to logout. When I try to put in this line:
    <a href="<?php echo wp_logout_url(); ?>">Logout</a>
    It just turns the code into part of the URL.
    Here is the pertinent part of my usless theme code that puts in the Logout link:
    						global $user_ID;
    						if($user_ID) {
    							echo '<li class="secondary"><a href="' . site_url('wp-login.php?action=logout', 'login') . '">' . __('Log Out', 'carrington') . '</a></li>';
    						} else {
    							echo '<li class="secondary"><a href="' . site_url('wp-login.php', 'login') . '">' . __('Log In', 'carrington') . '</a></li>';
    How do I change it so that you can actually logout? No use of this line of code as is seems to work at all!
  25. robert.futo
    Posted 6 years ago #

    Here is my solution for automatic loging out from wp 2.7:

    <a href="<?php echo wp_logout_url().'&amp;action=logout&amp;redirect_to='.$_SERVER['REQUEST_URI']; ?>">Logout</a>

  26. MrBen
    Posted 6 years ago #

    I was having this issue on a clients site - I disabled the Branded Admin plug in (http://kerrywebster.com/my-current-plugins/) and it all works again.

    So, if you are having issues try going through you're plugins and disabling them one at a time then try to log out.

    Worked for me.

  27. ernestortiz
    Posted 6 years ago #

    Hi. I just had the same "You are attempting to log out of (website name)" problem in WP 2.7 and found a simplest solution, I think.

    As you know the URL of this page is similar to
    (web root)/wp-login.php?action=logout&wpnonce=(numbers)
    Well, I just went to
    (web root)/wp-login.php?action=logout
    deleting the "&wpnonce=(numbers)", and cliked on the link that asks if you really want to close your session.
    And the problem is gone away forever!

  28. kckal
    Posted 6 years ago #

    thank you. this got my old theme up to date! helpful string overall as well. thank you all. wordpress is great.

  29. fmazoni
    Posted 6 years ago #

    Just replace the code <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" in your old theme (comments.php) for:
    <a href="<?php echo wp_logout_url(get_permalink()); ?>"
    This fix my problem.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.