Home › Forums › Feature Requests › Add ability to exclude drafts from Relationship field › Reply To: Add ability to exclude drafts from Relationship field
@lucidlips I might be confused, but I think this question is about filtering the ACF relationship field UI to exclude draft posts (admin), not how to not show draft posts on the front-end.
Your solution it explains how to exclude posts of a certain status from a loop, which I’m sure is helpful to many. But, it hasn’t nothing to do with ACF, but rather post loops.
BTW. post_status
is a column in the wp_posts
table and is returned with the WP_Post
object, so you could also use this condition:
<?php
if ( 'publish' === $post->post_status ){
// loop code
}
?>
ref: https://codex.wordpress.org/The_Loop
ref: https://codex.wordpress.org/Class_Reference/WP_Post
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.