Skip to content

Instantly share code, notes, and snippets.

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 Oscar-Abad-Folgueira/39146ad59ac692645fc0599dbd919be4 to your computer and use it in GitHub Desktop.
Save Oscar-Abad-Folgueira/39146ad59ac692645fc0599dbd919be4 to your computer and use it in GitHub Desktop.
WordPress Snippet: Redireccionar después de salir sin confirmación
<?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('&amp;', '&', 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