Support

Account

Home Forums General Issues Trouble with acf/fields/post_object/query Filter Reply To: Trouble with acf/fields/post_object/query Filter

  • Thank you for your reply John,

    $post_id is now set, but it is always set to 0.

    Possibly this is because I am using AJAX to load the form as described in this link.

    https://www.advancedcustomfields.com/resources/acf_form/#ajax

    I did some code tracing and here is the $_POST variable.

    [
    action => "acf/fields/post_object/query",
    nonce => "c35b1d6bc1",
    paged => "1",
    s => "",
    field_key => "field_588bcb6648c75"
    ]

    Because post_id is not set it defaults to 0 as defined in acf_field_post_object->get_ajax_query()

    Is this by design?

    EDIT:

    When I do this query from wp_admin, the post_id IS set.