PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

custom_post_type with a custom field

  1. rzn8media
    Member

    I've got a gForm that is submitting a post to a custom_post_type called "reviews". The "reviews" custom_post_type has a custom field in it called "ts_Name". When I add a custom field to the gForm as a single-line-text and try to assign it to a custom field from the drop-down my "ts_Name" isn't available - which makes sense because the gForms 1.4.5 isn't custom_post_type aware.

    Since we are intercepting the submission and changing the "post_type" anyway I assume the custom field re-assignment has to be done in a hook as well. I tried "add_post_meta" but that doesn't work because it seems the post_id is changed when the post is reassigned a new type.

    I just need to assign a gField to a custom-field in a custom post type. HELP?!?!?

    Posted 13 years ago on Tuesday January 25, 2011 | Permalink
  2. Two things to try/check:

    1) Does any post have a value stored for this custom field? If not, it technically doesn't exist and won't be populated in the dropdown for the Gravity custom field type.

    2) If another post is using this custom field and it does have a value stored, try just manually typing the custom field name on the Gravity custom field type and see if it works anyways.

    Posted 13 years ago on Wednesday January 26, 2011 | Permalink
  3. rzn8media
    Member

    I had tried both earlier. The field exists - I manually added a review and filled in the ts_rName field. Then filled out the form from the front-end and the new "review was posted but the ts_rName field was blank.

    I had seen earlier that this field didn't already exist so I chose "new" thinking it was worth a shot. this had no effect I think it created it as a custom filed for a regular post but not for a "custom_post_type" I can provide ftp and admin access if you want to have a closer look.

    Posted 13 years ago on Wednesday January 26, 2011 | Permalink
  4. Sure, go ahead and send the login to david@rocketgenius.com. Just a heads up, I will probably not be able to take a look until tomorrow morning.

    Posted 13 years ago on Wednesday January 26, 2011 | Permalink
  5. rzn8media
    Member

    Somehow I missed this post update. I managed to go figure out what's going on.. I had to click "New Field" even though it's not "new". I think custom post fields with an _varname (note usage of underscore) prevents meta_fields from showing up in the meta_filed list in the dropdown in the form field editor. FYI

    Posted 13 years ago on Saturday February 5, 2011 | Permalink
  6. @rzn8media Post meta with a key that begins with an underscore (ex. _keyname) are considered hidden. You use the underscore in front of the key name when you don't want it to appear in lists that display post meta key names. This is by design and is built in WordPress functionality. Underscores should only be used for hidden post meta values. If you want it visible in the drop downs that list existing keys you should not use an underscore.

    Posted 13 years ago on Saturday February 5, 2011 | Permalink
  7. I was scratching my head until I found this post. Thanks!

    Posted 13 years ago on Friday April 22, 2011 | Permalink