Home › Forums › General Issues › get_field() related_posts [only publish posts] › Reply To: get_field() related_posts [only publish posts]
This is something recent and I do not know when this was changed. As I said, at one time get_field() on the front of the site would only return published posts and/or any post the the current visitor was allowed to see. Now both post object and relationship fields call the function acf_get_psots() and this function forces 'post_status' => 'any'
and there are no filter hooks available in ACF to modify this.
Currently there are two choices
$query->set('post_status', false);
Beyond this the only advice I can give to to contact the developers. It appears that this function is used on both front and back end queries now and without adding them adding a filter to alter this in the format_value function for the field I don’t see any other way around this issue at this time.
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.