Form tag attributes not deploying to Netlify
-
I’m using a Gravity Forms filter to add support for Netlify Forms. Here’s my code:
//Add Netflify tag to GForms add_filter( 'gform_form_tag', 'form_tag_netlify', 10, 2 ); function form_tag_netlify( $form_tag, $form ) { $form_name = $form['title']; $form_tag = str_replace( "<form ", "<form name='{$form_name}' data-netlify='true'", $form_tag ); return $form_tag; }
This works and correctly adds the tag
data-netlify='true'
to my Gravity Forms<form>
tag output; however, when I deploy directly from WordPress to Netlify, thedata-netlify
attribute is lost (This also happens if I just try addingnetlify
). Weirdly enough, thename
attribute added by my code is carrying over.I am pretty sure this is not an issue on Netlify’s end as everything works as expected if I export my static site as a .zip and upload it through Netlify’s dashboard, and I am pretty sure it’s not a Gravity Forms issue since the code works as expected on my WP server.
Reference:
https://www.netlify.com/docs/form-handling/
https://docs.gravityforms.com/gform_form_tag/
- The topic ‘Form tag attributes not deploying to Netlify’ is closed to new replies.