Home › Forums › General Issues › only show published posts in Relationship / Post / Page Link picker etc › Reply To: only show published posts in Relationship / Post / Page Link picker etc
I had to look it up because I was under the impression that only published posts would be returned but
post_status (string / array) – use post status. Retrieves posts by Post Status. Default value is ‘publish’, but if the user is logged in, ‘private’ is added. Public custom statuses are also included by default. And if the query is run in an admin context (administration area or AJAX call), protected statuses are added too. By default protected statuses are ‘future’, ‘draft’ and ‘pending’.
These are retrieved using a AJAX call.
Anyway, these augments used in a relationship field can be altered using an acf/fields/relationship/query filter https://www.advancedcustomfields.com/resources/acf-fields-relationship-query/. The post object field has a similar hook https://www.advancedcustomfields.com/resources/acf-fields-post_object-query/
As far as the link field goes, I don’t have a clue about this one. It appears to use the built in WP link popup, but after testing, this only appears to return published posts.
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.