Last active
August 29, 2015 14:01
-
-
Save jprieton/4c4661986d19154843db to your computer and use it in GitHub Desktop.
Cierra la sesión del usuario en WordPress y redirige al home
This file contains 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 | |
function custom_logout() { | |
$logout = (bool) filter_input(INPUT_GET, 'logout'); | |
if ($logout) { | |
wp_logout(); | |
echo '<script type="text/javascript">window.location = "' . home_url() . '";</script>'; | |
} | |
} | |
// run it before the headers and cookies are sent | |
add_action('after_setup_theme', 'custom_logout'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment