Created
January 19, 2018 11:44
-
-
Save mrfoxtalbot/b02a0f04edcb7fa568dcaaad60b20edf to your computer and use it in GitHub Desktop.
Redirigir a otra página después de enviar un formlario de Contact Form 7 (distinguir a dónde si tienes varios formularios)
This file contains 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 add_action( 'wp_footer', 'mycustom_wp_footer' ); | |
function mycustom_wp_footer() { | |
?> | |
<script type="text/javascript"> | |
document.addEventListener( 'wpcf7mailsent', function( event ) { | |
if ( '947' == event.detail.contactFormId ) { // Sends sumissions on form 947 to the first thank you page | |
location = 'https://www.example.com/thank-you-1/'; | |
} else if ( '1070' == event.detail.contactFormId ) { // Sends submissions on form 1070 to the second thank you page | |
location = 'https://www.example.com/thank-you-2/'; | |
} else { // Sends submissions on all unaccounted for forms to the third thank you page | |
location = 'https://www.example.com/thank-you-3/'; | |
} | |
}, false ); | |
</script> | |
<?php } | |
// source: https://www.rocketclicks.com/client-education/contact-form-7-thank-page-redirects/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment