AMP Form Redirection
-
Hi CF7,
Just wondering it its possible to add a filter or function to redirect users after submitting a form on AMP pages:
https://www.ampproject.org/docs/reference/components/amp-form#redirecting-after-a-submission
It can only be done by setting Headers. From what I see in the ampcf7_submit_form() ajax function, there are already Headers set. Perhaps an admin setting with an optional redirect url for forms within this function might work:
$redirect_url = get_option(‘cf7_amp_form_redirect’);
if( ! empty($redirect_url) ) {
header(“AMP-Redirect-To: “.$redirect_url);
header(“Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin, AMP-Redirect-To”);
}Not sure if its exactly correct, but something like that.
Thanks!
- The topic ‘AMP Form Redirection’ is closed to new replies.