[Membership 2 Pro] Membership 2 redirect to member page depending on membership type

Hi, I'm looking to redirect users to different pages after login depending on their membership type. I found the code on the link below, but it doesn't work for me, I get the white screen of death. So I'm wondering if the code is ok.


  • Patrick Freitas
    • Staff

    Hi James

    Hope you are doing well.

    Wouldn't you mind, please, try this mu-plugin?

    1] Navigate to your /wp-content/ directory and create a new one named mu-plugins if it doesn't exist.
    2] Inside the mu-plugins folder create a file named m2p-login-redirect.php
    3] Edit the file and copy / paste this code snippet inside.

    	function( $user_login, $user ) {
    		$member = MS_Factory::load( 'MS_Model_Member', $user->ID );
    		if ( $member->has_membership( 11 ) ) {
    			$url = 'https://url.one/';
    			wp_redirect( $url );
    		} elseif ( $member->has_membership( 12 ) ) {
    			$url = 'https://url.two/';
    			wp_redirect( $url );
    		} elseif ( $member->has_membership( 13 ) ) {
    			$url = 'https://url.three/';
    			wp_redirect( $url );

    4] Save and close the file.
    5] The final path should look like /wp-content/mu-plugins/m2p-login-redirect.php

    You just need to update the membership ID to match your memberships.

    References on

    Let us know if you need any further help on this.
    Best Regards,
    Patrick Freitas

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.