Support

Account

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