Support

Account

Home Forums Feature Requests Add ability to exclude drafts from Relationship field Reply To: Add ability to exclude drafts from Relationship field

  • If you have multiple relationship fields and want to target them all just add this to your functions.php.

    add_filter( 'acf/fields/relationship/query','relationship_options_filter', 10, 3);
    
    function relationship_options_filter($options, $field, $the_post) {
    	
    	$options['post_status'] = array('publish');
    	
    	return $options;
    }

    ref: https://www.advancedcustomfields.com/resources/acf-fields-post_object-query/