You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All AMP post forms use XHR to submit the request. When we sanitize a form (#907) to upgrade a form[method=post][action=/foo] to form[method=post][action-xhr=/foo], we also need to make sure that the result of the form being submitted is handled as well. In particular, when we rewrite an action to an action-xhr we should add a query var to the URL like _wp_amp_action_xhr_converted=1(e.g. the action here could get sanitized to be /foo?_wp_amp_action_xhr_converted=1) so that when WP calls wp_redirect() we can hook into it and automatically sent the AMP-Redirect-To and Access-Control-Expose-Headers headers instead: https://www.ampproject.org/docs/reference/components/amp-form#redirecting-after-a-submission
Otherwise, if the action-xhr attribute was supplied to begin with, then no such redirect interception would be done, as then it would be assumed that the theme/plugin is already properly handling the XHR request client-side.
The text was updated successfully, but these errors were encountered:
All AMP
post
forms use XHR to submit the request. When we sanitize aform
(#907) to upgrade aform[method=post][action=/foo]
toform[method=post][action-xhr=/foo]
, we also need to make sure that the result of the form being submitted is handled as well. In particular, when we rewrite anaction
to anaction-xhr
we should add a query var to the URL like_wp_amp_action_xhr_converted=1
(e.g. theaction
here could get sanitized to be/foo?_wp_amp_action_xhr_converted=1
) so that when WP callswp_redirect()
we can hook into it and automatically sent theAMP-Redirect-To
andAccess-Control-Expose-Headers
headers instead: https://www.ampproject.org/docs/reference/components/amp-form#redirecting-after-a-submissionOtherwise, if the
action-xhr
attribute was supplied to begin with, then no such redirect interception would be done, as then it would be assumed that the theme/plugin is already properly handling the XHR request client-side.The text was updated successfully, but these errors were encountered: