Created
December 30, 2014 11:18
-
-
Save NateWr/88fa7686e21397ec4403 to your computer and use it in GitHub Desktop.
Redirect the user to a different page after they have submitted their reservation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Redirect After Submit for Restaurant Reservations | |
* Plugin URI: http://themeofthecrop.com | |
* Description: Redirect the user to a different page after they have submitted their reservation. | |
* Version: 1.0 | |
* Author: Theme of the Crop | |
* Author URI: http://themeofthecrop.com | |
* License: GNU General Public License v2.0 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
* | |
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU | |
* General Public License as published by the Free Software Foundation; either version 2 of the License, | |
* or (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | |
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
* | |
* You should have received a copy of the GNU General Public License along with this program; if not, write | |
* to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) | |
exit; | |
/** | |
* Hook in after a booking has been submitted | |
*/ | |
if ( !function_exists( 'rtbras_redirect' ) ) { | |
add_filter( 'rtb_insert_booking', 'rtbras_redirect' ); | |
function rtbras_redirect( $booking ) { | |
// Change the id from 1 to the id of the page you would like to | |
// to redirect to. | |
$id = 1; | |
?> | |
<script type="text/javascript"> | |
window.location.replace( "<?php echo get_permalink( $id ); ?>" ); | |
</script> | |
<?php | |
} | |
} // endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Nate,
Thanks a lot for this useful code.
I need your advice. How can I implement this to the multisite, which each subdiretory site has its own "Thank You" page?
Thank you in advance for your kind advice.
Wmg