Skip to content

Instantly share code, notes, and snippets.

@texe
Last active August 2, 2023 12:52
Show Gist options
  • Save texe/dac667b13b996d2708230a43cd2dec78 to your computer and use it in GitHub Desktop.
Save texe/dac667b13b996d2708230a43cd2dec78 to your computer and use it in GitHub Desktop.
WordPress - Redirect to home page after login/logout in WordPress
// redirect to home after login/logout
add_action('wp_logout','go_home');
function go_home(){
wp_redirect( home_url() );
exit();
}
add_action('wp_login','go_home_after_login');
function go_home_after_login(){
wp_redirect( home_url() );
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment