Skip to content

Instantly share code, notes, and snippets.

@bwhli
Created July 7, 2015 04:54
Show Gist options
  • Select an option

  • Save bwhli/bb63d1330afc9c64df78 to your computer and use it in GitHub Desktop.

Select an option

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

mdahlke commented Nov 29, 2016

Copy link
Copy Markdown

Just for a more common syntax...

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

@korrio

korrio commented Dec 4, 2016

Copy link
Copy Markdown

Thank you, it's helpful.

@vitaliikaplia

Copy link
Copy Markdown

Thanks! :)

@wkille

wkille commented Mar 7, 2017

Copy link
Copy Markdown

Thank you so much!

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