fbpx
skip to Main Content
info@gooribi.com Customer Login
24/7/365 Technical Support: 1-480-624-2500
For Sales: 1-571-310-4647 | M-F 10AM to 5PM

How To Auto Redirect Users After Logout From WordPress

This is a useful trick If you’re developing a website for client on WordPress and want to manually redirect users after logout of your WordPress website. By default, WordPress will redirect them to the login page of your website, but we can easily change it by adding following snippet to current theme’s functions.php file:

add_action(‘wp_logout’,‘auto_redirect_after_logout’);
function auto_redirect_after_logout(){
  wp_redirect( home_url() );
  exit();
}

Above snippet will redirect your users to the homepage of your website. You can also define custom URL or external URL by adding following snippet:


Back To Top