# Getting the post ID of the page a form is on

**URL:** <https://community.gravityforms.com/t/getting-the-post-id-of-the-page-a-form-is-on/11436>\
**Category:** Get Help\
**Tags:** embed\_post, post-id, gravity-wiz\
**Created:** [December 15, 2021, 10:25pm UTC](https://community.gravityforms.com/t/getting-the-post-id-of-the-page-a-form-is-on/11436 "2021-12-15T22:25:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rob.ruiz](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@rob.ruiz](https://community.gravityforms.com/u/rob.ruiz)\
**Post date:** [December 15, 2021, 10:25pm UTC](https://community.gravityforms.com/t/getting-the-post-id-of-the-page-a-form-is-on/11436/1 "2021-12-15T22:25:23Z")

</div>

I’m aware that there is a way to get the post ID of a post a form creates, however, that’s not what I want. I just want to get the post\_ID of the page/post a form is on. I’m aware that I can create a hidden field and dynamically populate the field with the post ID. OK. That’s close. However, I would rather not rely on a hidden field to give me the post ID because I want to be able to get the post ID the same way every time, regardless of what form it is (so not having to write php that checks the value of some random field by ID - on some forms the field might have ID 13, others it might be ID 4. Is there really no other way to get the post ID of the page the form is on?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dario](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/dario/32/3901_2.png) [@dario](https://community.gravityforms.com/u/dario)\
**Post date:** [December 16, 2021, 1:36pm UTC](https://community.gravityforms.com/t/getting-the-post-id-of-the-page-a-form-is-on/11436/2 "2021-12-16T13:36:43Z")

</div>

Hi Rob,

From what I understand you should be able to accomplish this use case with [Gravity Forms Populate Anything - Enable Dynamic Population - Gravity Wiz](https://gravitywiz.com/documentation/gravity-forms-populate-anything/) and a filter to populate the current post ID.

 ![Screen Shot 2021-12-16 at 10.35.53](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/f7e5db0a34f3d00731702db11b261058f657b2ed.png)

I hope this helps!

Best,

---

<div class="post-metadata">

**Author:** ![uamv](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/uamv/32/1412_2.png) [@uamv](https://community.gravityforms.com/u/uamv)\
**Post date:** [December 16, 2021, 9:20pm UTC](https://community.gravityforms.com/t/getting-the-post-id-of-the-page-a-form-is-on/11436/3 "2021-12-16T21:20:47Z")

</div>

You can also set a default value of the field using the [{embed\_post} Merge Tag](https://docs.gravityforms.com/embed_post-merge-tag/). To specifically populate the post ID, you would enter `{embed_post:ID}` as the default value.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [January 15, 2022, 9:20pm UTC](https://community.gravityforms.com/t/getting-the-post-id-of-the-page-a-form-is-on/11436/4 "2022-01-15T21:20:59Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
