Redirection after submitting Jetpack Contact Form
-
Hi:
Using most recent version of WP.
This thread is closed but I had another question for it: https://wordpress.org/support/topic/jetpack-redirect-after-contact-module-submition/
It’s explaining how to “redirect after form submission” as noted on THIS page: https://jetpack.com/support/contact-form/advanced-customization/
I am trying to redirect from the form on this page (https://www3.theampersandgroup.com/contact/) to this page after people submit the form: https://www3.theampersandgroup.com/guide/
I’d actually like to be able to redirect directly to the pdf that is ON that page but I don’t think that’s possible, is it? That link would be to https://www3.theampersandgroup.com/wp-content/uploads/2020/01/Ampersand-Resource-Guide-2020.pdf
So I only have one form on the site, and it is contact-form-17
So I tried this code:
$redirects = array( '17' => home_url( 'https://www3.theampersandgroup.com/guide/' ), );I entered this in code snippets:
/** * Jetpack Contact Form Custom Redirections. * * @param string $redirect Post submission URL. * @param int $id Contact Form ID. * @param int $post_id Post ID. * * @return string $redirect Custom Post submission URL. */ function jetpackcom_custom_form_redirect( $redirect, $id, $post_id ) { /** * Create a list of pages where you've inserted forms. * For each contact Form ID (found via the id attribute on the form), * set up a custom URL where the user will be redirected. */ $redirects = array( '17' => home_url( 'https://www3.theampersandgroup.com/guide/' ), ); // Let's loop though each custom redirect. foreach ( $redirects as $origin => $destination ) { if ( $id == $origin ) { return $destination; } } // Default Redirect for all the other forms. return $redirect; } add_filter( 'grunion_contact_form_redirect_url', 'jetpackcom_custom_form_redirect', 10, 3 );I saved this in code snippets. I didn’t know whether to change the default of: Run Everywhere, Run only in Admin, Run only on Front-end, Only run once from “Run Everywhere” to admin or front end – tried it with “Run Everywhere” and “Run only on front-end” and both gave me this error message after I submitted the form:
Forbidden
You don’t have permission to access this resource.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.`
So I don’t know what I’m doing wrong – is there something else I need to change? Do I just enter the destination page as:/guide/ instead of the entire url?
Help greatly appreciated.
The page I need help with: [log in to see the link]
The topic ‘Redirection after submitting Jetpack Contact Form’ is closed to new replies.