Support

Account

Home Forums General Issues Dynamic select box field values Reply To: Dynamic select box field values

  • You could make use of the load_field filter:
    http://www.advancedcustomfields.com/resources/filters/acfload_field/

    This should get you going!

    
    function dynamic_author_dropdown( $field ){
    	
    	$authors = get_users(array(
    		'role' => 'author'
    	));
    	
    	if(!empty($authors)){
    		foreach($authors as $author){
    			$field['choices'][$author->ID] = $author->display_name;
    		}
    	}
     
        return $field;
    }
     
    // acf/load_field/key={$field_key} - filter for a specific field based on it's key name , CHANGE THIS TO YOUR FIELDS KEY!
    add_filter('acf/load_field/key=field_508a263b40457', 'dynamic_author_dropdown');