WordPress.org

Ready to get started?Download WordPress

Forums

STRANGE wp_logout_url(get_permalink()); problem (3 posts)

  1. scdwb
    Member
    Posted 4 years ago #

    Hello,

    I'm having a problem redirecting users to the current page they are viewing when they log out. I have a logout link in the header using this code:

    <li><a href="<?php echo wp_logout_url(get_permalink()); ?>" rel="nofollow" title="<?php _e('Log out'); ?>"><?php _e('Log out'); ?></a></li>

    If I am on a single post or a wordpress page, then wordpress successfullly logs out and returns to these current pages.

    However, if I am on a category listing page, the home page or any other page on the website then wordpress redirect to the first post in the loop on these pages.

    So if I am on a category.php page for mobile phones with all the posts listed in this category, and I log out, it redirects to the first post displayed on the page.

    But it should redirect to the category page? As this is the current page I am on.

    This is very strange, does anyone know what the problem is?

    Thanks for your time.

  2. scdwb
    Member
    Posted 4 years ago #

    Can any one help out with this? I haven't a clue what is up.

    Thanks

  3. Flector
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.