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() ) {
self::create_missing_pages();
$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(
‘ms_model_pages_redirect_to’,
$url,
$page_type,
$args
);
wp_safe_redirect( $url );
exit;
}
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?