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.

Getting the POST ID

  1. Hello,

    I am using GF for user submissions to a custom post type. I have that working great.

    I am now in the process of taking part of the form information and creating a comment out of it. I am doing so using "gform_after_submission" along with "wp_insert_comment"

    Currently I am able to pass the users name, email, and the comment to the appropriate spots in the database.

    My only issue is associating this comment with the post that was created with this form.

    Do you know of a way to get the Post ID that was just created when submitting the form?

    Posted 12 years ago on Wednesday December 7, 2011 | Permalink
  2. Figured it out. I had to use $entry["post_id"]

    Posted 12 years ago on Wednesday December 7, 2011 | Permalink
  3. The gform_after_submission hook has access to the entry object which contains the post id of the post that is created by the form.

    Documentation for the gform_after_submission hook is here:

    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    Documentation for the entry object is here:

    http://www.gravityhelp.com/documentation/page/Entry_Object

    Posted 12 years ago on Wednesday December 7, 2011 | Permalink