Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Yep there’s a filter in the plugin to change the redirect location. See here: https://www.ads-software.com/support/topic/change-redirect-page/

    John

    Thread Starter joncwhall

    (@joncwhall)

    That’s awesome – thanks John, much appreciated ??

    Jon

    Thread Starter joncwhall

    (@joncwhall)

    Hi John,

    Apologies, I’m struggling to get this to work.

    I’ve changed ‘logout_redirect’ and ‘login_redirect’ to ‘https://www.theacademygtc.co.uk/club/’ but this causes relocation to https://www.theacademygtc.co.uk/wp-admin when I switch user.

    Should I be changing something else?

    Sorry if I’ve got this wrong.

    Thanks,

    Jon

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Here’s the correct code you need to change the redirection location:

    add_filter( 'login_redirect', function( $redirect_to, $requested_redirect_to, WP_User $new_user ) {
    	if ( $new_user->has_cap( 'edit_users' ) ) {
    		return admin_url( 'users.php' );
    	} else {
    		return home_url( 'club' );
    	}
    }, 10, 3 );

    However, I just remembered that User Switching appends the ?user_switched=true parameter to the return value of this function, so you won’t be able to avoid this.

    If you’re still being redirected to /wp-admin then there may be another plugin on your site which is filtering this URL too.

    Your best bet either way is to figure out why your page stops working with query parameters appended to the URL. This won’t be specific to User Switching.

    John

    Thread Starter joncwhall

    (@joncwhall)

    Hi John,

    I’ve figured out the plugin conflict and got it working – thanks for your help ??

    Jon

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Thanks for letting me know.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘?user_switched=true stops content reveal plugin working’ is closed to new replies.