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.
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.