membership redirect help needed

So awhile someone wrote me a custom mu-plugin to redirect members to different URLs based on their membership level. It’s not working and I’m wondering if you can help.

  • Nithin
    • Support Wizard

    Hi Stuart,

    Hope you are doing good today. :slight_smile:

    I could notice the above code you had should have worked, I even tested couple more codes but unfortunately it wasn’t helping much. I’m bringing this into our Second Level Support(SLS) teams attention, so that we could get back to you with a working code asap.

    Please do note that SLS works on complex issues, and have a slow response time. Will get back to you via the ticket asap.

    Have a nice day ahead. :slight_smile:



  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hey Stuart ,

    You can use this code snippet to redirect the members depending on their Memberships.

    How to install:

    Always make sure to keep a backup of your site before changing/adding custom code.

    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 = '';

    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 will have to update the code and change the number in each has_membership( 11 ) with the IDs of your memberships and the $url in each case for the url that you want your users to be redirected to.

    Tell me if you need more help with this !



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.