Redirect members to a specific page when logging in Paid Memberships Pro

Redirect members to a specific page when logging in Paid Memberships Pro on child sites.

Snippet Type

Execute on Child Sites

Snippet

function my_pmpro_login_redirect_url( $redirect_to, $request, $user ) {
	// If logged in and a member, send to members page.
	if ( pmpro_hasMembershipLevel( null, $user->ID ) ) {
		$redirect_to = '/members/';
	}

	return $redirect_to;
}
add_filter( 'pmpro_login_redirect_url', 'my_pmpro_login_redirect_url', 10, 3 );
1 Like