Logout

function custom_logout_redirect() {
    // Only proceed if the user is logged in
    if ( is_user_logged_in() ) {
        wp_logout(); // Log the user out
        wp_redirect('https://glorietta.xpresso.ph/');
        exit; // Stop execution to ensure redirect works
    }
}
<script>
    document.getElementById('logout-button').onclick = function() {
        window.location.href = 'wp-admin/admin-ajax.php?action=custom_logout_redirect';
    };
</script>

Comments are closed.

Are you sure?

Are you sure you want to log out?