I have wordpress blog and I'm currently using this code to provide Logout link:- <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a> PHP: And it is working almost correct but, when I am click the Logout this on Homepage it takes me to another page and when I am on Category page it takes me to Last Updated post of the Category, same with the tags and other Archives And I am not using any caching plugin also. Please Help me to out of this problem, I will wait for your reply.
Try this: <a href="<?php echo get_settings('siteurl') . '/wp-login.php?action=logout&redirect_to=' . $_SERVER['REQUEST_URI']; ?>" title="<?php _e('Log out'); ?>"><?php _e('Log out'); ?></a>
Oh, Okay! I see the issue! Here, try this for the homepage fix. <?php if( is_home() ) { ?> <a href="<?php echo wp_logout_url( home_url() ); ?>" title="<?php _e('Log out'); ?>"><?php _e('Log out'); ?></a> <?php } else { ?> <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="<?php _e('Log out'); ?>"><?php _e('Log out'); ?></a> <?php } ?> PHP: