WordPress Redirect users to home page after login

You want to redirect users to home page after login in WordPress.

To do this follow the following process.

Step One: Open your WordPress web site as an administrator.

Step Two: Then go to the WordPress Dashboard.

Step Three: Then move your mouse pointer and hold on Appearance menu.

Step Four: Then move and click on the Editor sub menu.

Step Five: Then Select theme to edit.

Step Six: Click on the functions.php page (This is your current theme page)

Step Seven: Then place the following code into functions.php page.

The code is:


function redirect_to_front_page() {
global $redirect_to;
if (!isset($_GET['redirect_to'])) {
$redirect_to = get_option('siteurl');
}
}
add_action('login_form', 'redirect_to_front_page');

Leave a Reply