Created
November 21, 2023 09:49
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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