Support

Account

Home Forums Feature Requests Filtering acf_get_posts args Reply To: Filtering acf_get_posts args

  • Hi John,

    The issue is because there’s no way to pass a custom array of $args into the acf_get_posts() function from the acf_field_post_object::get_posts() method as there are no filters in this method and it’s being called by acf_field_post_object::render_field().

    That’s why the snippet in my original post suggests adding the three filters so this can be adjusted if we need to do so.

    The post status adjustment in acf/fields/post_object/query is to allow the AJAX search to search for that specific post status, otherwise again it uses any which will miss out my custom archived status. This section works perfectly, the issue comes when the field is then rendered on page load using acf_field_post_object::render_field() which comes back as blank.