How can I redirect a user after a confirmed appointment to a thank you page when payment is not requ

I found this solution within the FAQ of the Plugin which is added to the functions.php file:

function app_redirect( $script ){
    return str_replace("window.location.href=app_location()", "window.location.href=''", $script);
add_filter( 'app_footer_scripts', 'app_redirect' );

which works ok when you only have one Thank You page per MU installation. But within a MU Subdomain, I need to be able to go to the Thank You page of that domain and preferably, to be able to set the exact page, as it may differ per Site within MU.

Does anyone have any ideas or suggestions on how to get this to work?

The main reason for a Thank You page rather than a Pop Up Message, is so that it can contain the Google Tracking Code for recording Goals and Conversions upon a form submission or appointment confirmation.

Thank you in advance for any help,


    I have also added this code to the functions.php file:

    function rebind_footer_redirections ($script) {
    	return $script . '$(".appointments-confirmation-cancel-button").off("click").on("click", function () {window.location.href=app_location();});';
    add_filter('app_footer_scripts', 'rebind_footer_redirections', 999);

    as per another related thread (I made a thank you page to redirect clients to after) and appears to be working ok.

    I still need to know how to dynamically change the sub-domain (keeping it the same as the site which has the appointment made from) and if possible setting the exact thank you page per site?

  • PC

    Hey there,

    Thanks for posting back.

    I am not sure on how it can be done on a subdomain unless you create a page per domain but yeah, then I see how it can be complex as the plugin is activated network wide but can only be edited once.

    Let me call our lead developer @Vladislav for his thoughts on the same and see if he has got any ideas on the same.

    May be it can become a nice feature as a Thank you page addon for the plugin which can be used on site by site basis.

    Sales &Support

  • Vladislav


    This might get tricky, as we would need a way to tell which page is the "Thank You" page for each specific site. Abstracting this hurdle, the rest of the code should be relatively straightforward:

    function app_redirect ($script) {
    	$page_id = 1; // <-- This is where we get the "Thank you" page ID, somehow
    	$url = get_blog_permalink(get_current_blog_id(), $page_id);
    	return str_replace("window.location.href=app_location()", "window.location.href='" . $url . "'", $script);
    add_filter('app_footer_scripts', 'app_redirect');

    As you see, the first line in the "app_redirect" function is where we're making an assumption about the ID of the "Thank you" page for a blog. In the example above, we're using a hardcoded ID, for simplicity sake. Again, this part of the process is the trickiest and it's dependent on how we're determining which page is the "Thank you" page.

    Here's a bit more involved example, that assumes that if the site has a page with "thank-you" slug, that's the "Thank you" page we'll be using. Otherwise, if the site doesn't have a page with this slug, we'll fall back to default behavior of refreshing the page:

    function app_redirect ($script) {
    	$page = get_page_by_path("thank-you");
    	$url = ($page && !empty($page->ID))
    		? "'" . get_blog_permalink(get_current_blog_id(), $page->ID) . "'"
    		: 'app_location()'
    	return str_replace("window.location.href=app_location()", "window.location.href={$url}", $script);
    add_filter('app_footer_scripts', 'app_redirect');

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.