I’ve brushed by the problem of getting the Gravity Forms wordpress plugin to populate wordpress content a few times now and while it can handle basic post creation by default, with Title, Content, Images, Category, Tags, etc.. what if you need a front end form to create or populate a Custom Post Type and fill in the various bits of meta/taxonomy information that might be contained in that custom post type?
For one of my latest projects I’m building a property site and using an off the shelf template that comes with a custom post type called Listings which has contained within it custom fields and taxonomies such as:
- Property Type,
- No of Beds,
I figured initially that this should be easy enough but on researching found it wasn’t! Luckily the Gravity Forms + Custom Post Types plugin does pretty much all you need. Here’s how it works:
Install and activate the above plugin and go create a new Gravity Form as usual and add a new Title field from the ‘Post Fields’ section. This will be the title of the post and in my case, property name. Go into the advanced settings for that field and tick Save as Custom Post Type. The drop down box choice will list any custom post type created already. See below:
Next create either a drop down, multiple choice or checkbox field and go into the Advanced tab of the field settings and tick ‘Populate with a Taxonomy’, choosing your taxonomy from the resulting list. If you add a list of taxonomies to the custom post type in wordpress admin then these will be the values that populate that drop down/checkbox list on the front end when someone uses the form! See here:
For this particular site I’m working on I can now have a client register an account, list a property (with ‘Pending’ status) and pay for the listing all through 1 form. Cool!