Skip to content

Instantly share code, notes, and snippets.

@emre-edu-tech
Created November 21, 2023 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emre-edu-tech/b4a6afec72ba1291f283999412144d10 to your computer and use it in GitHub Desktop.
Save emre-edu-tech/b4a6afec72ba1291f283999412144d10 to your computer and use it in GitHub Desktop.
Wordpress - Tweak the logout function. Redirect user to home page after logging out.
<?php
// Tweak the logout function to redirect to home page after logging out
add_action('wp_logout','auto_redirect_after_logout');
function auto_redirect_after_logout(){
wp_safe_redirect( home_url() );
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment