Support

Account

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