WP – Redirect to home page after successful login

So I needed a front-end login page that redirects you to the homepage after a successful login.

Using the default WP login form, you only need to supply the ‘$args’ needed to redirect after the login. See code below.

<!– wp_login_form() is located in wp-includes/general-template.php. Line 470 –>
$args = array(
‘redirect’ => ( get_option(‘home’) ) // this redirects you to home page after successful login.
<?php wp_login_form( $args ); // this pulls in the form ?>
<a class=”forgot” href=”<?php echo wp_lostpassword_url(); ?>”>Forgot Password?</a>


Works like a charm.

Leave a Reply

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