Last active
November 21, 2024 14:27
-
-
Save desenvolvendositeswp/3fa87fea2a81fcfbca2463951cb167dc to your computer and use it in GitHub Desktop.
Fazer logout no Wordpress direto
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 | |
add_action('check_admin_referer', 'logout_without_confirm', 10, 2); | |
function logout_without_confirm($action, $result) | |
{ | |
/** | |
* Allow logout without confirmation | |
*/ | |
if ($action == "log-out" && !isset($_GET['_wpnonce'])) { | |
$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'inicio'; | |
$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