[Membership2] Redirect after registration

Once I have a user compete the registration form, I would like to redirect them to a different page than the default one. How do I accomplish this?

  • Sajid
    • DEV MAN’s Sidekick

    Hi @Mike

    Hope you are doing good today :slight_smile:

    To redirect on account page after registration add following code in functions.php file or use mu-plugin . Now replace the text custom-url-here with account page URL in below code.

    add_filter( 'ms_model_pages_redirect_to', 'custom_redirect', 10, 3 );
    function custom_redirect( $url, $page_type, $url_params ) {
        if ( MS_Model_Pages::MS_PAGE_REG_COMPLETE == $page_type ) {
            $url = 'custom-url-here';
    
            // Add the URL-params again, if you want to keep track which membership
            the user just signed up to.
            $url = esc_url_raw( add_query_arg( $url_params, $url ) );
        }
    
        return $url;
    }

    For second issue, if the account page is being created successfully then you should not need to worry about warnings. These are for developers and should not be enabled on live websites. To disable the warnings and enable log please add below code in wp-config.php file replacing define('WP_DEBUG', true);.

    // Enable WP_DEBUG mode
    define('WP_DEBUG', true);
    // Enable Debug logging to the /wp-content/debug.log file
    define('WP_DEBUG_LOG', true);
    // Disable display of errors and warnings
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors',0);

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.