Skip to content

Instantly share code, notes, and snippets.

@bwhli
Created July 7, 2015 04:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save bwhli/bb63d1330afc9c64df78 to your computer and use it in GitHub Desktop.
Save bwhli/bb63d1330afc9c64df78 to your computer and use it in GitHub Desktop.
Redirect WordPress Logout to Home Page
//* Redirect WordPress Logout to Home Page
add_action('wp_logout',create_function('','wp_redirect(home_url());exit();'));
@mdahlke
Copy link

mdahlke commented Nov 29, 2016

Just for a more common syntax...

function logout_redirect_home(){
	wp_safe_redirect(home_url());
	exit;
}
add_action('wp_logout', 'logout_redirect_home');

@korrio
Copy link

korrio commented Dec 4, 2016

Thank you, it's helpful.

@vitaliikaplia
Copy link

Thanks! :)

@wkille
Copy link

wkille commented Mar 7, 2017

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment