When working with Gravity Forms, to get your post data updated at the front end, it can’t happen without this great plugin: Gravity Forms: Post Updates.
While it’s really awesome (and free) but like every (free) plugin in the wild, there is always one or two (…or three) things just can’t work as we expected.
The problem I met is, when updating the post, the post tags and some custom fields kept got wiped out. Because the post tags field was not added to the form and I hide those custom fields conditionally, I thought they got wiped out just for they didn’t exist in the form.
But soon I found the custom fields were in the form but got hidden with inline CSS “display:none” (added by Gravity Forms). Then I went back to the source code, realised the Post Update plugin deletes meta values if you check the “Unique Custom Field?” box in the field settings. By unchecking this box, my data is safe now.
As to the post tags, I had to add it to the form and applied a CSS class “
gform_hidden” to get it hidden. (If I just set it to “Admin Only”, it still got wiped out after form submission.)
So lessons learned here:
- When using conditional logic for “custom fields” and would like to work with the Post Update plugin, DO NOT check the “Unique Custom Field?” box or you’ll lose the data while user who can’t see these fields update the form.
- Even if you just let admins to apply post tags at the post editing screen, the post tags field has to be added to the forms. You must hide it with the CSS class “
gform_hidden“, set it visible to “Admin Only” won’t work, it would still get wiped out.