Home › Forums › ACF PRO › Get Post ID of post where acf_form is embedded within acf/validate_value › Reply To: Get Post ID of post where acf_form is embedded within acf/validate_value
Hi Dorn
Thanks for the question and follow up answer
I have a similar problem where I am trying to get the ID of the page containing the form. However, the form creates new posts so the post_id returns as 0. Has anyone found a way of retrieving.
I have tried
$post_id = $_POST['post_id'];
$url = 'https://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ];
$current_post_id = url_to_postid( $url );
get_queried_object_id()
global $post;
$post_id = $post->ID;
etc...
I have also tried adding additional parameters to the function but alas....
All return 0. Is what I’m attempting actually possible?
Thanks
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.