Membership 2 Pro custom redirect

The Membership 2 Pro redirect to "Thank you" page after signup. The redirect add-on doesn't take effect in this case as it only works with login/logout and if we don't want to use any 3rd-party solutions, how can this be overriden?

There's this function in /app/model/class-ms-model-pages.php file that seems to be handling all redirects:

There's the function that performs all the redirects based on the parameters that it gets, in /membership/app/model/class-ms-model-pages.php file around line 534:
* Redirect the user the specified membership page.
* @since 1.0.0
* param string $page_type The page-type.
* param array $args Optional. Additional URL parameters.
static public function redirect_to( $page_type, $args = array() ) {
$url = self::get_page_url( $page_type );

$url = esc_url_raw( add_query_arg( $args, $url ) );

* Opportunity for other plugins to redirect to a different page.
$url = apply_filters(

wp_safe_redirect( $url );

There's a "ms_model_pages_redirect_to" filter that most likely could be used for this from mu-plugin so how do I use it to redirect freshly registered member to a specified page on site instead of the default "Thank You" page?

    • Ellis Benus

      Majid's solution will redirect everyone to that page. I've added some code to check for the Membership Name and redirect based off that. You could make a custom redirect for every membership level if you wanted.

      // Membership 2 Custom Redirect
      add_filter( 'ms_model_pages_redirect_to', 'custom_thank_you_page', 10, 2 );
      function custom_thank_you_page( $url, $page_type ) {
      	// Get the current member/user
      	$member = MS_Model_Member::get_current_member();
      	// Iterate through all the user's memberships
      	foreach ( $member->subscriptions as $subscription ) {
      		$membership = $subscription->get_membership();
      		$memberships[] = $membership->name;
      	// If the user is in "Membership Name" membership, then redirect to custom Thank You page
      	if ( in_array('Membership Name', $memberships ) ) {
      		$url = '';
      		return $url;
      	// If none of the above are met, redirect to default URL
      	return $url;

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.