Last active
March 22, 2022 09:57
-
-
Save Oscar-Abad-Folgueira/39146ad59ac692645fc0599dbd919be4 to your computer and use it in GitHub Desktop.
WordPress Snippet: Redireccionar después de salir sin confirmación
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 | |
/** | |
* @snippet WordPress Snippet: Redireccionar después de salir sin confirmación | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/ | |
*/ | |
add_action('check_admin_referer', 'logout_without_confirm', 10, 2); | |
function logout_without_confirm($action, $result) | |
{ | |
if ($action == "log-out" && !isset($_GET['_wpnonce'])) { | |
$redirect_to = '/'; | |
$location = str_replace('&', '&', wp_logout_url($redirect_to)); | |
header("Location: $location"); | |
die; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment