Title: [Plugin: Gravity Forms   Custom Post Types] Meta fields in an array?
Last modified: August 20, 2016

---

# [Plugin: Gravity Forms Custom Post Types] Meta fields in an array?

 *  [webicycoffee](https://wordpress.org/support/users/webicycoffee/)
 * (@webicycoffee)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/)
 * Great plugin, a huge timesaver!
 * I wanted to see if there was a way to accommodate custom post types that were
   set up as an array rather than in separate custom fields. For example:
    - _my_meta[‘first_name’]
    - _my_meta[‘last_name’]
 * I’d rewrite the CPT, but there’s already hundreds of posts entered. Any suggestions
   for a hack?
 * [http://wordpress.org/extend/plugins/gravity-forms-custom-post-types/](http://wordpress.org/extend/plugins/gravity-forms-custom-post-types/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [timmmmyboy](https://wordpress.org/support/users/timmmmyboy/)
 * (@timmmmyboy)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590095)
 * I’m looking for the exact same functionality. I’m working with a theme that already
   has a ton of information populated and built in, but they use arrays instead 
   of separate custom fields and I can’t populate them from a Gravity Form. I’d 
   love to find out how to do this!
 *  Plugin Author [bradvin](https://wordpress.org/support/users/bradvin/)
 * (@bradvin)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590096)
 * This can definately be done, but as you say it would require some hacking. The
   best way I can think of catering for this is to add a checkbox under advanced
   settings for the custom field. something like:
 * [x] Save value to array
    Array key [___________________________]
 * so when you check “save value to array” it shows another textbox “array key” 
   where you can enter the key used in the array eg. ‘first_name’
 * Would something like that work for you?
 *  [timmmmyboy](https://wordpress.org/support/users/timmmmyboy/)
 * (@timmmmyboy)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590099)
 * I think that would definitely work. Seems a lot more elegant than the hacks I’m
   seeing of converting every array to individual custom fields. How difficult would
   it be to add the functionality?
 *  Thread Starter [webicycoffee](https://wordpress.org/support/users/webicycoffee/)
 * (@webicycoffee)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590111)
 * That’d definitely work. It seems like we’d have to lean on Gravity Forms for 
   something like that, no?
 *  Plugin Author [bradvin](https://wordpress.org/support/users/bradvin/)
 * (@bradvin)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590112)
 * I can give it a go. Not sure if it should be part of the GF+CPT plugin though.
   What do you think?
 *  [timmmmyboy](https://wordpress.org/support/users/timmmmyboy/)
 * (@timmmmyboy)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590113)
 * Might be too edge case to build into the plugin, but if you at least knew what
   we could add to the code to make it happen I’d be happy with that solution. My
   guess is GF would never build it into their code base because of how small the
   likelihood is that someone would run into a situation like that, but I’d love
   it if we could make it work within this plugin. 🙂
 *  [djdeejay](https://wordpress.org/support/users/djdeejay/)
 * (@djdeejay)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590186)
 * Guys I have a theme that users a custom post type which has its own meta box –
   it appears they are setup as arrays somehow. I really need gravity forms to talk
   to these boxes as ive got everything else working but i need these boxes in.
 * Did you ever add this option/hack to the plugin?
 *  Plugin Author [bradvin](https://wordpress.org/support/users/bradvin/)
 * (@bradvin)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590187)
 * we never added this option to the plugin, as it was too “edge case”, but people
   have done this by creating their own little plugin that hooks into the GF set_post_values
   filter
 *  [djdeejay](https://wordpress.org/support/users/djdeejay/)
 * (@djdeejay)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590188)
 * Would anyone have such a plugin to share? Thats a little beyond my coding abilities
   and if its already been done…?
 * For the record this is the code in the theme which creates the meta box in the
   custom post type of “portfolio”. Would the set_post_values filter work for this
   upon first glance?
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   The maximum number of lines of code that you can post in these forums is **ten
   lines**. Please use the [pastebin](http://wordpress.pastebin.com/)]_

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘[Plugin: Gravity Forms Custom Post Types] Meta fields in an array?’ is
closed to new replies.

 * ![](https://ps.w.org/gravity-forms-custom-post-types/assets/icon-256x256.png?
   rev=2542252)
 * [Gravity Forms + Custom Post Types](https://wordpress.org/plugins/gravity-forms-custom-post-types/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravity-forms-custom-post-types/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/)
 * [Active Topics](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/reviews/)

 * 9 replies
 * 4 participants
 * Last reply from: [djdeejay](https://wordpress.org/support/users/djdeejay/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-custom-post-types-meta-fields-in-an-array/#post-2590188)
 * Status: not resolved