Redirect user after login

Adding this snippet to the functions.php of your wordpress theme will redirect the user to your homepage after they login.

 

<?php
add_action('login_form', 'redirect_after_login');
function redirect_after_login() {
global $redirect_to;
if (!isset($_GET['redirect_to'])) {
$redirect_to = get_option('siteurl');
}
}
?>

Be Sociable, Share!

Leave a comment