Support

Account

Home Forums Front-end Issues Displaying multiple select field labels Reply To: Displaying multiple select field labels

  • I’m trying to apply this to an option page, but cannot get it to work.

    
    $labels = array();
    $field = get_field_object( 'sidebar_home', 'option' );
    $values = get_field( 'sidebar_home', 'option' );
    foreach ($values as $value) {
       $labels[] = $field['choices'][ $value ];
    }
    
    //And this is how I'm displaying it
    <?php echo implode(', ', $labels); ?>
    

    I’m getting an “Illegal offset type” error.

    My select field is set to multiple choices and a return format of “Both (Array)”.

    Any clues of why I’m getting that error?

    Thanks!