Hi Shane,
Thanks, but I’ve already read (and re-read) the Codex entry for wp_login_url several times now, and I’ve tried the $index.php
solution already listed in fUzZy89’s earlier post – neither of which work for me. As I said in my original post, wp_logout_url() does appear to be generating a correctly formed logout URL which points back to the homepage URL of my website, i.e.
https://www.mysite.com/blog/wp-login.php?action=logout&redirect_to=https://www.mysite.com/blog/&_wpnonce=1234567890
…but, when this URL is used, WordPress ends up going to the most recent post instead, i.e.
https://www.mysite.com/blog/2009/05/20/my-most-recent-post
I’ve also tested by disabling all plugins just in case any of those were hooking into the login/logout or post viewing routines, but sadly this didn’t solve the problem either.
Just to recap, the redirect works fine on ALL other pages EXCEPT the front page. If a user attempts to log out whilst viewing the front page, then they are logged out successfully, but redirected to my most recent post even though the logout URL is supposedly redirecting them back to the front page of the site.
I suspect it might be something to do with a combination of my Settings -> Reading -> Front Page Displays option being set to Your Latest Posts and the fact that the template I’m using contains a file called home.php