Title: [Plugin: AJAX Login Widget  ] Errors when logging out
Last modified: August 19, 2016

---

# [Plugin: AJAX Login Widget ] Errors when logging out

 *  [Dalton Rooney](https://wordpress.org/support/users/daltonrooney/)
 * (@daltonrooney)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-ajax-login-widget-errors-when-logging-out/)
 * When I try to log out using this widget, I get an error 404 not found. I have
   identified that it’s this line causing the problem in alw_template.php:
 * `<?php echo wp_logout_url('/wp-login.php?action=logout&redirect_to=' . $_SERVER['
   REQUEST_URI']); ?>">`
 * My WordPress is installed in a sub-directory and so /wp-login.php is not found.
   I have modified the code to
 * `<a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout
   </a>`
 * That seems to do the trick. Thought I would save some time for anyone else trying
   to use the plugin.
 * Dalton
 * [http://wordpress.org/extend/plugins/ajax-login-widget/](http://wordpress.org/extend/plugins/ajax-login-widget/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [marco2020](https://wordpress.org/support/users/marco2020/)
 * (@marco2020)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-ajax-login-widget-errors-when-logging-out/#post-1896887)
 * hi,
 * i’m not good with coding – where do i place the above code?
 * thanks in advance – Mark
 *  [marco2020](https://wordpress.org/support/users/marco2020/)
 * (@marco2020)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-ajax-login-widget-errors-when-logging-out/#post-1896888)
 * all sorted thanks – learning more and more about this wordpress stuff!!
 *  [DivaVocals](https://wordpress.org/support/users/divavocals/)
 * (@divavocals)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-ajax-login-widget-errors-when-logging-out/#post-1896948)
 * Dalton Rooney’s fix did correct the error, but did not leave me on the page I
   was viewing when I logged out. (And isn’t that the BIGGEST reason we all want
   this plugin?? 🙂 )
 * For example I was viewing a blog category page and if I logged out while there
   in stead of staying on the page I was on, I was redirected to the post page for
   the 1st post in the category I was viewing.
 * So following some info I found here:
    [http://codex.wordpress.org/Function_Reference/get_permalink](http://codex.wordpress.org/Function_Reference/get_permalink)
 * I made the following changes to the file
 * > ajax-login-widget/alw_template.php
 * .
    . . Find this (it’s towards the end of this file): `(<a href="<?php echo wp_logout_url('/
   wp-login.php?action=logout&redirect_to=' . $_SERVER['REQUEST_URI']); ?>">log 
   out</a>)` . . . Change to: `(<a href="<?php echo esc_url( wp_logout_url( $_SERVER['
   REQUEST_URI'] ) ); ?>">log out</a>)` . . . This will fix the logout error and
   leave you on the page you were viewing when you log out. Hope that helps someone..
   I really like this plugin, but I fear it’s starting to show signs of it’s age
   after not being updated in nearly 2 years.. 🙁 . . .
 * > **_Edited to add_**: I am using this posted fix with **WordPress v3.2.1** in
   > case anyone is interested..
 *  [bhomatude](https://wordpress.org/support/users/bhomatude/)
 * (@bhomatude)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-ajax-login-widget-errors-when-logging-out/#post-1896962)
 * I was having a similar problem with logging out, but needed a redirect to a certain
   page… Here is a [link](http://codex.wordpress.org/Function_Reference/wp_logout_url)
   that explains it all!
 * Default Usage
 * `<a href="<?php echo wp_logout_url(); ?>" title="Logout">Logout</a>`
 * Logout and Redirect to Current Page
 * `<a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout
   </a>`
 * Logout and Redirect to Homepage
 * `<a href="<?php echo wp_logout_url( home_url() ); ?>" title="Logout">Logout</
   a>`
 * Logout and Redirect to Another Site
 * If you are using wp_logout_url to redirect to another site on logout (e.g. another
   subsite in a MultiSite network) you’ll need to make use of the allowed_redirect_hosts
   filter
 *     ```
       add_filter('allowed_redirect_hosts','allow_ms_parent_redirect');
       function allow_ms_parent_redirect($allowed)
       {
           $allowed[] = 'multisiteparent.com';
           return $allowed;
       }
   
       <a href="<?php echo wp_logout_url( 'http://multisiteparent.com' ); ?>" title="Logout">Logout</a>
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: AJAX Login Widget ] Errors when logging out’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ajax-login-widget.svg)
 * [AJAX Login Widget++](https://wordpress.org/plugins/ajax-login-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-login-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-login-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-login-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-login-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-login-widget/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [bhomatude](https://wordpress.org/support/users/bhomatude/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-ajax-login-widget-errors-when-logging-out/#post-1896962)
 * Status: not resolved