Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

logout wp without confirmation

/**
 * Generates custom logout URL
 */
function getLogoutUrl($redirectUrl = ''){
    if(!$redirectUrl) $redirectUrl = site_url();
    $return = str_replace("&", '&', wp_logout_url($redirectUrl));
    return $return;
}

/**
 * Bypass logout confirmation on nonce verification failure
 */
function logout_without_confirmation($action, $result){
    if(!$result && ($action == 'log-out')){ 
        wp_safe_redirect(getLogoutUrl()); 
        exit(); 
    }
}
add_action( 'check_admin_referer', 'logout_without_confirmation', 1, 2);
Source by gist.github.com #
 
PREVIOUS NEXT
Tagged: #logout #wp #confirmation
ADD COMMENT
Topic
Name
1+1 =