How To Auto Redirect Users After Logout In WordPress

By default, in WordPress, whenever a user logs out, it will get redirected to the login page of your website. This may not be the best user experience, we may went to redirect them to a different page instead.

We can easily redirect users after logout in WordPress by adding following code snippet to your website:

function auto_redirect_after_logout(){
  wp_safe_redirect( home_url() );

The above snippet will redirect your users to the homepage of your website. We can also set a custom internal or external URL by using this snippet instead:

function auto_redirect_external_after_logout(){
  wp_redirect( '' );

If you found this post useful, share it with your friends:

6 thoughts on “How To Auto Redirect Users After Logout In WordPress”

    1. Yes but this article is not about changing the logout url, which is automatically generated by WordPress, but to redirect users to certain page after they logged out

  1. Just a couple of things :
    – If you redirect to your own homepage please use “wp_safe_redirect()” instead.
    – Exit statement does not require ()

Leave a Reply