Home › Forums › ACF PRO › Get the $post_id in render_field method › Reply To: Get the $post_id in render_field method
Oops! Don’t worry about it, I just realised I can access the post ID from my previous AJAX call via $_POST.
I still agree with @emrl and think it’d be good to include the post ID somehow. As an example, my application is a task manager. When clicking on a task a modal pop-up opens with the acf_form. I have registered a custom ACF field that lets you add subtasks, so when adding one I’m calling wp_insert_post() and I need the task post ID to set the post_parent on the subtask.
I’m sure there are many more scenarios where the post ID would be useful 🙂
Cheers guys, keep up the good work!
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!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.