Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Users abandon the site after they login, seeing WordPress backend


Burt Adsit
Participant

@burtadsit

I found a little filter hook in wp-login.php that seemed just right for this. It is buried in that mass of stuff in that file on line 436 (wpmu 2.7).


$redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);


So I built a little plugin that hooks this filter.


function oci_login_redirect($redirect_to, $set_for, $user){
$redirect_to = bp_core_get_userurl($user->ID);
return $redirect_to;
}
add_filter('login_redirect', 'oci_login_redirect', 10, 3);


Create a file with the above code and drop it into /mu-plugins. It sends the user to their profile after logging in. You can send them wherever you want them to go by changing $redirect_to.

Skip to toolbar