How To Bypass Logout Confirmation?

To bypass log out confirmationyou need to add the following code to your theme’s functions.php.

Note: These codes will be wiped out after a theme update. So, you need to create a child theme and add the codes there. You can check out this easy Tutorial on Creating a Child Theme.

So, after creating your Child Theme, you can add these codes in the child theme’s function.php.

// Logout without confirmation.
function ur_modify_logout( $url, $endpoint, $value, $permalink ) {
if( ‘user-logout’ === $endpoint ) {
$url = add_query_arg( array(
‘_wpnonce’ => wp_create_nonce( ‘user-logout’ ), ),
$url
);
}
return $url;
}
add_filter( ‘user_registration_get_endpoint_url’, ‘ur_modify_logout’, 10, 4 );

After you have pasted the code, you will be able to logout with a single click from the account dashboard.

Powered by BetterDocs