Save Gravity Forms Advanced Field to Custom Meta Field

Last month , it happen that I need to build something for a client using the Gravity Forms , it is my first time using Gravity Form this premium plugin, it is a very interesting plugin which help a lot if you need a front end submission form, I would like to share one of tips how you can use the advanced field mapping to the custom meta field of a post.

For example if you want to map a form field to a custom meta field for the post, just drag the Custom Field from the Post Fields section to your form and select from the drop down, which custom field it should map to, very easy.


by now, when the user submit the form, the form value will auto save to that particular custom meta value, but what if you want to use the Gravity Forms Advanced Field ? some of the Gravity Forms Advanced Field allow you to save lots of time , for example the address field, you created all the fields in one go, no need to create each address field one by one.

Gravity Forms Advanced Field

How to map this Gravity Forms Advanced Field to your Custom Meta Field ? you need to write some code and put it under your functions.php , the action name should be gform_after_submission_<your form id> , the parameter $entry[‘29.3’] is map to 3rd sub field , for example if your Address field id is 29 , the 3rd field will be City, it follow the number order, you just need repeat the update_post_meta

Additional tips:

  • If you want to save the Gravity Forms Entry to custom post type, use this plugin
  • If you want to save Gravity Forms Advanced Field to ACF Plugins , use this gists , it just replace update_post_meta function with ACF function.


Share it with your friends, thanks !
Share on FacebookTweet about this on TwitterShare on Google+Share on TumblrBuffer this pagePin on PinterestEmail this to someone

You may also like...

  • CM

    This is great. However, I’m curious if this can work with dropdowns, radio buttons.

  • David Baker

    You may want to look at gform_update_meta instead of update_post_meta. As far as I’m aware gravity forms stores entries in a separate table. So while update_post_meta may work for lower form ID numbers it will start to fail once your form entries exceed the number of blog posts on your site (if that makes sense)