• Hello

    Plugin can setting redirect page after login?
    We use google one tap it easy to use , thank you for plugin

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello. I have also used this plugin and I like it a lot, especially for its simplicity.
    I also tried after a user login to use WordPress to redirect to the main page instead of wp-admin. I used the login_redirect filter. But it does not work. Can you write the code to redirect your plugin? Thanks and congratulations for your work

    I am also having issues with the “login_redirect” filter when using this plugin. The filter works fine with using regular wordpress user/pass login. Please fix or direct where to look in your code to fix.

    Did some more digging and found the filter rtcamp.google_default_redirect which allowed me to redirect on login. It would be nice if this filter passed the user object like the wordpress login_redirect filter so I could potentially redirect to different locations like I can with login_redirect

    I believe @manthano has already posted the solution.

    Hello Can you please help me, I would like to redirect to the default website URL instead of the WP-Admin page.

    Hi @manthano Do you have an example you can post here of how you implemented the rtcamp.google_default_redirect you mentioned? – Thanks!

    • This reply was modified 3 years, 1 month ago by mpmchugh.
    • This reply was modified 3 years, 1 month ago by mpmchugh.
    • This reply was modified 3 years, 1 month ago by mpmchugh.

    Sure. Here’s what I’m using

    
    add_filter( 'rtcamp.google_default_redirect', 'a403_google_login_redirect' );
    function a403_google_login_redirect ( $url ) {
    	$user = wp_get_current_user();
    	if ( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
           		if ( $user->has_cap( 'administrator' ) ) {
                		$url = admin_url(); // redirect to wp-admin for admin users
            	} else {
               		$url = site_url(); // redirect to site homepage for everyone else
            	}
        	}
        	return $url;
    }
    

    @manthano thanks so much! That’s a big help. ??

    @manthano Thanks for your code. I used it on my website, but the redirect adds a /1 after the url. Any idea what I’m doing wrong?
    Thanks in advance!

    @artnijenboer Just a hunch, but you probably have another plugin or some custom code that also uses the login_redirect filter and is adding that /1 … maybe a pagination plugin?

    @manthano thank you for your fast response! I guess you’re right. I found a quick fix to make the redirection work with the shortcode.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Redirect after login’ is closed to new replies.