AJAX Login Widget++
Errors when logging out (5 posts)

  1. Dalton Rooney
    Posted 5 years ago #

    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.



  2. marco2020
    Posted 5 years ago #


    i'm not good with coding - where do i place the above code?

    thanks in advance - Mark

  3. marco2020
    Posted 5 years ago #

    all sorted thanks - learning more and more about this wordpress stuff!!

  4. DivaVocals
    Posted 5 years ago #

    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:

    I made the following changes to the file


    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..

  5. bhomatude
    Posted 4 years ago #

    I was having a similar problem with logging out, but needed a redirect to a certain page... Here is a link 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

    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>

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • AJAX Login Widget++
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic