Replies
Hello – I sent them your reply and they said this:
Thank you page is a WP page. We add special content to this page, but even though we don’t have a specific function to check for a thank you page, however, you can still check if it’s a page via is_page function.
I asked this:
Okay, so you don’t know what they name of the page is? Would it not be thank you?They replied with this:
According to is_page documentation: https://developer.wordpress.org/reference/functions/is_page/ page ID is one of the supported so you can use a function in this way and check for its ID ( id for the thank you page)
is_page(346)END
I checked and my thank you page ID is 1401
Here is what they said:
In the first message they said:
“I am using a Profile Completion plugin. It redirects user to their profile after sign up and forces them to complete fields before accessing other pages.”
Does that mean that they want to stop redirecting users to the Thank you page and redirect all users to the profile page? In that case they can use this code:
add_filter(‘mepr-thankyou-page-url’, function($url, $args) {
return ‘https://cool-domain.com/profile-page/’; // Replace it with the URL to Profile page
}, 10, 2);If they want to have a condition to check if this is a Thank you page redirection during checkout, here’s the condition:
if( isset($_POST[‘mepr_product_id’]) ) {
// It’s a checkout request so you can catch it to skip redirection
}After that, I asked:
Could you please tell ask how about if they want to stop the redirection entirely? I think he wants the redirect code that he can look for it to make it work with his code.Then, they said:
When you are using the MemberPress checkout process, it requires users to be redirected to some page (we call it the Thank you page, but it might be any page). That’s why you can use the hook from the previous message to redirect to the chosen page. There’s no way to stop redirection entirely, unfortunately.Thank you! They said:
They can try using the following code to override the URL so they can apply the logic to the code to redirect users to a different page than the Thank you page. It can’t be just ignored and return nothing.
add_filter(‘mepr-thankyou-page-url’, function($url, $args) {
// Replace the condition below or remove it completely to redirect to different URL
// for all signups
if( isset($_POST[‘mepr_product_id’]) && (int) $_POST[‘mepr_product_id’] == 123 ) {
return ‘https://cool-domain.com/basic-course/’;
}
return $url;
}, 10, 2);The code should be added within the WPCode plugin https://memberpress.com/docs/how-to-add-custom-code-snippets-in-wpcode/