WordPress.org

Ready to get started?Download WordPress

Forums

More Privacy Options
Redirect back to blog instead of dashboard (3 posts)

  1. Michael
    Member
    Posted 3 years ago #

    Would it be possible to have an option for a site administrator to set whether the newly logged in user is sent to the blog home instead of to the dashboard. The dashboard redirect is confusing for users, especially those who would only have subscriber access.

    I am currently directly hacking the plugin (which is would not be maintainable for our organization long-term) changing the following in three places.

    header('Location: ' . wp_login_url());

    to

    header('Location: ' . wp_login_url()."?redirect_to=". home_url());

    http://wordpress.org/extend/plugins/more-privacy-options/

  2. Jason Lemahieu (MadtownLems)
    Member
    Posted 2 years ago #

    Doesn't the plugin automatically redirect the user to exactly where they tried visiting when prompting for a login? o_O

  3. David Sader
    Member
    Plugin Author

    Posted 2 years ago #

    Does commenting out the redirect filter(~line 67) altogether help?
    add_filter( 'login_url', 'ds_my_login_page_redirect' );
    //add_filter( 'login_url', 'ds_my_login_page_redirect' );

    You can use your own plugin to filter the login redirect as I have done there:

    function ds_my_login_page_redirect() {
    //	$redirect = urlencode( $_SERVER['REQUEST_URI'] );
    	$redirect = home_url();
    	$page = get_option( 'siteurl' ) . '/wp-login.php?redirect_to=' . $redirect;
    	return $page;
    }
    add_filter( 'login_url', 'ds_my_login_page_redirect' );

    This way all your calls to wp_login_url in your templates/plugins will redirect as you want.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic