ACF Dynamic select not showing data


I have a question. I have 2 types of custom field group: Group A and Group B. All I am using ACF.
In Group A, I have field name course_trainer. This field type is a User type and can have multiple values.

In Group B, I have field name class_trainer.This field type is a Select type and cannot have multiple value. This field will display data from field course_trainer. Basically, I used dynamic select for data to display at class_trainer.

If course_trainer field type not using multiple values, I can manage to display the data but if field type can have multiple values, the data not display at all.

I create a function in function.php to display the dynamic select:

function acf_load_t_first_name2_field_choices($field) {
    global $post;
    //$post = $_GET['post'];
    // reset choices
    $field['choices'] = array();

    // get the textarea value from options page without any formatting
    $choices = get_field('t_first_name',$post->ID);

    // loop through array and add to field 'choices'
    if( is_array($choices) ) {

        foreach( $choices as $choice ) {

            $field['choices'][ $choice ] = $choice;



    // return the field
    return $field;


add_filter('acf/load_field/name=course_trainer', 'acf_load_t_first_name2_field_choices');

Can someone correct my codes? Please help me 🙁

, user3239674 4 years 2020-03-04T03:50:54-05:00 0 Answers 47 views 0

Leave an answer