This guide shows how to Redirect WordPress Logout so people land on a page you choose, instead of the default login screen. You need one action and a URL on your own site.

The sample sends logged-out visitors to the home page. Change that URL if the home page is wrong for your audience, but keep the target public.

What the logout hook does

WordPress fires wp_logout after the auth cookies are cleared. A callback on that hook can call wp_redirect() and then exit. Without exit, later code can send a second Location header and the browser may ignore yours. The hook is documented on the wp_logout reference.

Use a path on this site. home_url( '/thank-you/' ) is safer than a hardcoded domain, because it follows the site address if you move hosts. Sending the logout request to another domain is unnecessary and easy to get wrong.

Redirect WordPress Logout with a snippet

Put the code in a custom plugin or in Code Snippets. Do not edit a parent theme for this. A theme update will wipe the callback and logout will fall back to the login screen. Adding custom code the right way covers where snippets should live.

Sign-in is a different hook. If you also send people somewhere after they log in, use the login redirect filter. Logout and login do not share a callback, and mixing them is how redirect loops start.

<?php
/**
 * Redirect users to home page after logging out of WordPress.
 */

function my_redirect_after_logout_wp(){
  wp_redirect( home_url() );
  exit;
}
add_action('wp_logout','my_redirect_after_logout_wp');

Check the result before you leave it

Log in as a subscriber in a second browser, then log out. You should land on the URL inside wp_redirect(), not on wp-login.php. If the browser reports a redirect loop, the target page is sending logged-out visitors back to login, and that login page is logging them out again. Point the redirect at a public page that does not require a session.

Every account follows this URL, including administrators. Test with a private window before you leave the snippet active on a busy site. If you only want one role redirected, check the current user inside the callback and return early for everyone else.

Stay in the loop!

15% off your next purchase, just for you 🎁

Sign up to receive your exclusive discount, and keep up to date on our latest news, products & offers!

We don’t spam, ever! Read our privacy policy for more info.