Themergency fooplugins.com

Gravity Forms + Custom Post Types

Current version 3.0.1
Downloaded 51253 times!
View this page on WordPress.org

This plugin is an add-on for the amazing Gravity Forms Plugin.
Check out my other free Add-ons for Gravity Forms

Gravity forms allows you to create posts from a form using ‘post fields’. By default the submitted form will create a post, but I wanted a way to save a custom post type instead. It can be done quite easily with some php code, but I wanted it to be easier without any code at all. Now it is easy. Maybe too easy :)

You can also link a custom taxomony to the field types : Drop Downs, Mulit Selects, Radio Buttons, Checkboxes and Single Line Text. So when the form is displayed a list of terms for the custom taxonomy are listed. And then when the post (or custom post type) is created, it automatically links the post to the selected taxonomy term(s).

features

  • Map a form to a custom post type (using the post title field)
  • Map fields (Drop Downs, Multiple Choice or Checkboxes) to a custom taxonomy
  • Supports Gravity Forms v1.5 and over (including v1.6)
  • Ability to have more than 1 taxonomy linked in a form (see screenshots)
  • Hierarchical dropdowns for hierarchical taxonomies (see screenshots)
  • Populate a dropdown with posts
  • Ability to set a parent post using the dropdown control
  • Single line text field can link to taxonomies by entering a comma seperated list
  • Enhanced UI on single line text fields to show a “tag input” styled control (see screenshots)

How to map a form to a custom post type

Add a post title field to your form and under the advanced tab, tick the “Save As Post Type” checkbox. A dropdown will appear with the available post types. Select the one you want.

How to link a field to a custom taxonomy

Custom taxonomies can be linked to Drop Downs, Mulit Selects, Radio Buttons and Checkboxes. Under the advanced tab for your field, tick the “Populate with a Taxonomy” checkbox. A dropdown will appear and you can select your custom taxonomy from the list.

How to link the saved post to taxonomies using a single line text field

You can also link a Single Line Text field to a taxonomy, so it can be used to input existing and new taxonomy terms. Under the Advanced tab, click “Save to Taxonomy” checkbox and then select the taxonomy from thr drop down. You can also choose to show an advanced UI by checking the “Enable enhanced UI” checkbox. This will enable an awesome “tag input” style control. See screenshot for more info. If the control contains exising terms, then they are linked to the saved post. If there are new terms in the control, then the terms are created and they are also linked.

How to set a parent post with the dropdown field

You can now link the dropdown field to a post type and try to make it set the parent item. Under the advanced tab, check the “Populate with Post Type” checkbox. Select the SAME post type that you selected when adding a post title field (above), and check “Try to set parent”. This then fills the dropdown with a list of existing posts, so when you save the form and the post is created, it trys to set the parent post to whatever was selected in the dropdown.

Download

Latest version: Download Gravity Forms + Custom Post Types v3.0.1 [zip]

Installation

  1. Upload the plugin folder ‘gravity-forms-custom-post-types’ to your /wp-content/plugins/ folder
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Make sure you also have Gravity Forms activated.

FAQ

Q. Does this plugin rely on anything?
A. Yes, you need to install the Gravity Forms Plugin for this plugin to work.

Changelog

3.0.1

  • Fixed minor bug causing a PHP warning (FILE)
  • removed the restriction of not including scripts when a call is ajax

3.0

  • Removed support for Gravity Forms v1.4.5. Now supports v1.5 and up (including 1.6)
  • Added support for single line text fields
  • Added ability to populate a dropdown with posts
  • Added ability to set a parent post when saving a post form
  • Multiselect control now supports “populate with taxonomy” too
  • “first value” default overriden when populating with a taxonomy
  • Shows taxonomy selections when designing the form
  • Fixed support for conditional logic
  • Previews now load taxonomy terms
  • Previews can show enhanced UI (only in V1.6 and above)

2.0

  • Added support for both Gravity Forms v1.5 beta and v.1.4.5
  • Now supports linking taxonomies to Drop Downs, Multiple Choice or Checkboxes
  • Integrated with GF v1.5 hooks for easier configuration (thanks to Alex and Carl from RocketGenius)
  • Support linking more than 1 taxonomy to a form
  • To keep in line with the GF standards, mapping a form to a CPT in GF v1.4.5 can now be done via the ‘post title’ field

1.0

  • Initial Relase. First version.
124 comments
  Livefyre
  • Get Livefyre
  • FAQ
ldsgrps

Hi,

Awesome plugin.

I am using  gravity form Version 1.9.3 and GF+CPT Version 3.0.1  how can i save custom field as array? I can change post_meta as single value but there are1000ts of post are posted already. I am glad to hear how to save custom field as array.


Thanks.

code_help_please

Hi


I'm creating a new form. I created a custom post type with Custom Post Type UI and some custom fields with Andvanced Custom Fields. Originally the field names were showing in Gravity forms  > Post Fields > Custom fields >custom field name



However for new fields it is now showing a long, unidentifiable number along the lines of 'field_53e3e2b7c85cf'.


I've uninstalled wordpress and wiped my database but no luck. This is happening on both my live and development instances.

Colin999
Colin999

@code_help_please 

Create a manual entry in your CPT and save it. Your fields will then show the proper names in GF. Create your form and you can then delete your first manual entry.

Bonlando
Bonlando

This is a great plugin!


I'm curious if there is a reason why the advanced section for post types > custom field doesn't have the populate with a post type/taxonomy.  


It would be great if I could pull the post type into a drop down, like it does under advanced fields > dropdown does, and then export it to a custom field. 

MikeGrace
MikeGrace

Getting these warnings with debug turned on:


[30-Apr-2019 20:36:30 UTC] PHP Strict Standards:  Non-static method GFCPTAddon::get_base_path() should not be called statically in /{obscured-path}/public_html/wp-content/plugins/gravity-forms-custom-post-types/gfcptaddon.php on line 55

[30-Apr-2019 20:36:30 UTC] PHP Strict Standards:  Non-static method GFCPTAddon::get_base_path() should not be called statically in /{obscured-path}/public_html/wp-content/plugins/gravity-forms-custom-post-types/gfcptaddon.php on line 58

amalakar
amalakar

Awesome plugin


Can you tell me how if i can populate a checkboxes with a CPT title instead of a taxonomy?


Thanks

Punica

Great Updates :-)


i have a question - i use yoast seo and there you have the focus keyword.
i assume i have to use "post custom field" but this field is not amongst the existing field names
how can i find or make a new one , i am totally lost on that!

ach258

Hi!


Awesome plugin!


I have 2 issues I can't figure out:


1) The Date on the form upon submission is not being passed through to the custom field created. I've read through a bunch of documentation but nothing has come of it.


2) When I preview the draft post, only the title and the current date shows up - nothing else.


Any ideas/suggestions?


Thanks!

marse
marse

The ability to upload a file and then have the form create a custom post type with a link to said file worked perfectly for so long then it has twice disappeared on me.

I updated Gravity Forms and Gravity Forms + Custom Post Types and things went back to normal the first time. But now, after what I think was an update of WP to 3.8.1 the links have disappeared again.

They are added to the backend - I can see them and they work manually, but none show up on the front end.

My students use this to upload material for critique. ALL previous entries (600+ have no upload links) and none of the new ones do.

Please help or pint me in the right direction for help. Until this is resolved I have to do all the linking manually. Ugh.

Thanks,
Mark

dogood
dogood

Hello themergency! 


Also having an issue with checkbox fields populated by custom taxonomy exporting #ID. 


( for example '23' instead of 'Aderdeen City')


- Gravity Forms: 1.8.3

- Wordpress 2.8



Any fixes or advice very much appreciated!

Thanks!

dogood
dogood

Update. Installed in the beta plugin (http://themergency.com/gfcpt-beta-download/) Still testing.. but new entries are working on .csv export! Now two questions:


1. Older entries are still broken (showing the #ID's) is there any fix for these?


2. Any moves to bringing the plugin out of beta? Paid of free, we'd jump at it! Anything we can do to help?

Colin999
Colin999

@themergencyI would be more than happy to pay for this plugin if it had support and was compatible with GF1.8. It is a key part of functionality that I require on a complex site that I am currently building.

themergency
themergency moderator

@dogood old entries will show the ID's unfortunately. But a way to "upgrade" the old entries is a good idea!


This has been in "beta" for over a year now (maybe 2 actually). With my new premium plugins taking my main focus, I do not have the time to develop this free plugin any longer. It used to make quite a bit of money from affiliate sales, but WP.org forced me to take out all affiliate links in the readme.txt :(


I am still thinking about releasing a pro version of this plugin under the fooplugins banner, and then offer support for it too. I am just unsure of the response it would get.

Colin999
Colin999

Any idea when this will be compatible with GF 1.8?

luclemo
luclemo

I have a checkboxes field populated by custom taxonomy, and a dropdown populated by custom post type. In both cases the entries in the admin show up as numerical values (i imagine the taxonomy and post IDs). I would like the entries to display the post titles and taxonomy terms instead. Currently they display as:


Workshops:

  • 1145

Categories:

  • 34
  • 56

I would like it to display:


Workshops:

  • Custom post type title

Categories:

  • actors
  • directors

Is this possible?


Thank-you for a fantastic plugin.

Brian Busche
Brian Busche

The Gravity Forms + Custom Post Types plugin has been working great for me, with one exception.  A multi-select gravity form field only appears to pass one of the selected values when reviewing the draft post in the admin panel.  For example, I have a "State" field where a user can choose "Alabama, Illinois, California", etc.  When the custom post is created, that "State" field shows only "Alabama" selected.  I have made sure to tell ACF that this select field can accept multiple values.

ckhicks
ckhicks

The get_base_path() function needs to be run statically with newer versions of PHP - edit line 123 of gfcptaddon.php as follows:


`protected static function get_base_path(){`

jgbneatdesign
jgbneatdesign

@ckhicks Thanks a lot! You saved my life with this trick. Again thanks!

ianvhilton

Really want to use the plugin, but can't with these errors... What am I doing wrong?
//Strict Standards
: Non-static method GFCPTAddon::get_base_path() should not be called statically in /home/wp-content/plugins/gravity-forms-custom-post-types/gfcptaddon.php on line 55//

//Strict Standards: Non-static method GFCPTAddon::get_base_path() should not be called statically in /home/wp-content/plugins/gravity-forms-custom-post-types/gfcptaddon.php on line 58 //

DavidJay99
DavidJay99

I am running GF 1.7.7 and GF+CPT 3.0.1. 

The issue I am having is with taxonomies and when I try to set a default placeholder like "Select a size" and leave the show value field blank when I save the form it populates the value field with default placeholder.

Does this sound like a conflict with another plugin or is there a work around so I can prevent a from from being submited with the placeholder as the value for a required field?

Brian Busche
Brian Busche

I am using the 3.0.1 version along with GF 1.7.11 and Advanced Custom Fields 4.3.0

 

My gravity form successfully creates a custom post type in draft mode, as I intended.  All fields are populated except for the File Upload field.  This field shows up blank despite the fact that I am uploading a file.  Is this type of field not supported?  In Advanced Custom Fields I created a "file" type field.  In Gravity Forms it is set to a Custom Field Type of "FIle Upload", and I select the existing field name from the drop down.

iphoenix

Any chance you'd build in support for Pricing fields and Signature field?  Is this supported any more?

iphoenix

I also am getting these errors:

 

Strict Standards: Non-static method GFCPTAddon::get_base_path() should not be called statically in /wp-content/plugins/gravity-forms-custom-post-types/gfcptaddon.php on line 55

 

Strict Standards: Non-static method GFCPTAddon::get_base_path() should not be called statically in /wp-content/plugins/gravity-forms-custom-post-types/gfcptaddon.php on line 58

holling
holling

HI themergency - great plugin! I'm noticing some folks reporting the plugin being broken on WP 3.6.1. I haven't had a chance to test it myself, but wondering if you've experienced the same problems, and if so, do you have any solutions. 

 

(I'm happy to test this myself...just wanted to check and see if it was something you have duplicated or are already addressing.)

 

Cheers -  Bob

themergency
themergency moderator

 @holling Hey Bob,

 

I just ran a test using WP 3.6.1 and GF 1.7.10 and everything worked 100%. If you could also do a quick test with an example you are using that would be very helpful thanks

danromanchik
danromanchik

 @themergency  @holling I have just upgraded my WP site to 3.6.1, and I've started having trouble with one of my forms. When I submit the form, I get the message, "Hospital Name is empty." Hospital Name is the label for the title field, and it's definitely not empty. The custom post is created with the correct title but none of the fields have data. Thinking it might be Gravity Forms, I upgraded it to 1.7.11, but it's doing the same thing.

danromanchik
danromanchik

 @themergency  @holling Also, it didn't occur to me to do this yesterday, but just now this morning, I deactivated the Gravity Forms + Custom Post Types plugin, and I'm not getting the error message. Of course, I'm not creating the custom post type, either.

brycejacobson
brycejacobson

 @danromanchik  @themergency  @holling  Ran into the same issue. After form submission I get a blank page with "Company/Employer is empty". Its the first field on the form that I'm submitting to a custom field name "employer". Running Gravity Forms 1.7.11, WordPress 3.6.1 and Gravity Forms + Custom Post Types 3.0.1.

danromanchik
danromanchik

 @brycejacobson  @themergency  @holling Thanks for confirming the problem, Bryce. I really need to get this problem resolved, so that I can finish this project. I'm at the point where I can't decide what would be easier - hacking this plugin's code or just post-processing the form data myself. 

themergency
themergency moderator

 @danromanchik  @brycejacobson  @themergency  @holling I think it might have something to do with custom fields. At this point I would like to get 2 things : your custom post type registration code and also your form export XML. With those 2 things I can try to reproduce the problem in my local dev environment. If you could send me the above via my contact form then we can get this sorted asap - thanks guys

danromanchik
danromanchik

 @themergency  @brycejacobson  @holling I just sent you the XML via your contact form. I don't have the custom post type registration code because I created it using the Pods plugin.

danromanchik
danromanchik

@danromanchik @themergency @brycejacobson @holling Still waiting for a fix. Is there some way that I could help you? Perhaps you could point me at the appropriate place in your code and I could have a look at it.

brycejacobson
brycejacobson

@themergency @danromanchik @brycejacobson @holling Just tried the v4 beta and the same issue is still there. It claims the first field that is using a custom field is empty. I just upgraded to WordPress 3.8 so not sure if that has anything to do with it.

adentone
adentone

Hi themergency - great work on this plugin!

Maybe you or someone that has some experience with this plugin can help me do something "simple".

 

In the plugin features list it mentions "Populate a dropdown with posts" - and I cannot figure out how to do that.  I am trying to create a multiple select field populated with the "titles" of my custom post type "judges" so that my visitors can pick one or several of them.

 

I am sure I'm missing a simple step - but I've been staring at my screen for too long to find what I am looking for... 

 

Thanks for any guidance you can provide.

themergency
themergency moderator

 @adentone add a dropdown field to your form, then under the advanced tab, select populate with a post type and then choose your judges CPT. This only allows selecting a single post at the moment

AndersonNarciso
AndersonNarciso

Hy man, nice plugin. But, if I activate the conditional Logic in the form is not shown in page ... Why?

themergency
themergency moderator

 @AndersonNarciso if you deactivate GF+CPT plugin, does the form still not show? If you still have the same behaviour then it is an issue with GF itself

RobbyShaver
RobbyShaver

 @themergency  @AndersonNarciso I had that same problem, and I deactiveted the conditional logic and the form still appeared. 

wdo

The populate with taxonomy and save to taxonomy works on some old forms that I created, but when I duplicate these forms or create new ones, it doesn't seem to work... 

 

Any ideas?

wdo

Just to give a bit more detail... I'm using the same taxonomies with the exact same form settings but when we type a taxonomy item into the single text field, no dropdown appears.

 

There are no JS errors or anything on the page and the form still submits.

NoseGraze
NoseGraze

I can't seem to get the custom taxonomy feature to "stick".  I create a dropdown, check "Populate with taxonomy", select my taxonomy from the list, and save the form.  But then when I go back to check it, the "populate with taxonomy" thing is set back to "Select a Taxonomy".  It doesn't actually save my selection.

themergency
themergency moderator

 @NoseGraze Im sorry but I cannot reproduce this issue. What version of GF are you using?

NoseGraze
NoseGraze

 @themergency Version 1.7.6.  No worries though.  I never got it working but I used something else to do what I needed.

danromanchik
danromanchik

Is there any way to save the custom post as "published" not "draft"?

b72649
b72649

Is this plugin compatible with the GF 1.7.5 update? If not, are there plans to update the plugin to make it compatible? Thanks!

BruceGilbert
BruceGilbert

I have gravity forms installed and activated and also gravity forms custom post types. When I add a form field and go to the advanced tab, I don't see the option to 'save as post type' as should be displaying. What could I have done wrong?

energy0m
energy0m

hey first off AWESOME plugin ... questions though... for some reason whenever i do the taxonomy link it will not allow the data of multiple taxonomies if selected to be submitted. Only the first taxonomy once selected gets set.. have you ever seen this behavior ? any suggestions for a fix?