Sick of having your blog’s users sent to the Dashboard after they log in? Here’s a quick way to redirect all registered users to your blog’s homepage. Just add the following code to your theme’s functions.php file.

<?php
add_filter( 'login_redirect', 'mf_redirect_login' );
function mf_redirect_login( $c ) {
	return get_bloginfo( 'url' );
}
?>

5 Responses to “Redirect Users to Homepage Instead of Dashboard after Logging into WordPress”

  1. Hey, thanks for this tip! Works great. Question: Can I apply the same concept for logout?

    • Hi Mr “Web Design”,
      Yes, that is quite easy as well. Please try the following code:

      add_action( 'wp_logout', 'mf_redirect_logout' );
      function mf_redirect_logout() {
      	wp_safe_redirect( get_bloginfo('url') );
      	exit();
      }
  2. kailoon says:

    Can I redirect users to the post?

    I have this in the adress

    DOMAIN?redirect_to=A_POST_URL

  3. effect says:

    this function seems to redirect me to only 1 level up. For example if I am on http://yonge.cs.ucl.ac.uk/wordpress/password-recovery address
    it redirects me to http://yonge.cs.ucl.ac.uk/wordpress/ (Which is ok, since it’s my homepage).
    But if I am on http://yonge.cs.ucl.ac.uk/wordpress/category/letters_1850-1859 address, it sends me to http://yonge.cs.ucl.ac.uk/wordpress/category (it’s not my homepage and this page does not exist). Do you know how to solve this problem?
    My login form is located on the header of the website.

Leave a Reply

You may use the following html: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>