Redirect WordPress Users After Login

In this tutorial, we’ll be implementing a code snippet that will help WordPress users redirect to a specific page of their choice right after they log in. By default, after logging in, WordPress redirects users to the dashboard or the page they were on before logging in. This code, however, changes that default behavior to redirect users to the homepage of your website immediately after they log in.

You can add this code to your functions.php file in your WordPress child theme. Alternatively, if you prefer a safer method, use a plugin like Code Snippets.

function ts_custom_login_redirect() {
    return home_url(); 
}

add_filter('login_redirect', 'ts_custom_login_redirect');