Return to the Homepage After Logging Out Without Plugins

You’ve probably noticed that after logging out—whether as an administrator or a regular user—WordPress redirects you to the login page instead of the homepage, which would actually make more sense.

If you want users to be redirected to the homepage after logging out, and you don’t want to use any plugins at all that would bloat your site, all you need to do is edit your functions.php file and add the following:

// Redirect to homepage after logout
add_action( 'wp_logout', 'acc_redirect_after_logout' );
function acc_redirect_after_logout() {
    wp_redirect( '/' );
    exit();
}

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *