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.