Home › Forums › General Issues › Populate text field with post id on submission › Reply To: Populate text field with post id on submission
The code you posted is for populating the choices of a select field and will not work for adding a value to a text field.
You cannot populate the post ID into a text field on a front end form, assuming you are using acf_form() before the new post is created. This could only be done after the post is created.
See acf/save_post
The post ID is passed to your action and then you can use update_field() to insert set the field.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.