Monday, 26 August 2013

redirect to homepage after login

redirect to homepage after login

I have installed a site in my localhost. I have used a static home page
with a wordpress login in it. The blog is hosted at localhost/blog.
(i have followed the wordpress guide on how to get the wordpress index by
keeping it inside a sub folder)
the issue im having is once the user is logged in it automatically
redirects to the /blog path. But i want to redirect it to the main home
page.
This is what i have tried so far
Added the below code to the functions.php
/* redirect users to front page after login */
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');
added plenty of login redirect modules but none of them work, all of those
simply redirects to the blog page.

No comments:

Post a Comment