Skip to main content
Login Join
Snippet · PHP

Redirect Users After Logout

Shared by Darshit Rajyaguru · May 21, 2026 · @wp_logout

1 copy
39 views
2 upvotes
Back to Snippets

Redirects users to the homepage after logout.

function dr_logout_redirect() {
    wp_redirect( home_url() );
    exit;
}
add_action( 'wp_logout', 'dr_logout_redirect' );
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments