Support

Account

Home Forums Backend Issues (wp-admin) load values and labels from custom taxonomy select field

Unread

load values and labels from custom taxonomy select field

  • Hi,
    I’m trying to load different labels to the taxonomy select field (admin back-end only) but with no luck. The values are returning as default, $term->name only.
    With filter acf/fields/taxonomy/result the same with changed the first 2 character:
    {“results”:[{“id”:81,”text”:”A?ycustomlabel:…….

    
    function render_component_field($field) {
    	
        $field['results'] = array();
    
        $args = array(
            'taxonomy'   => 'call_components',
    		'hide_empty' => false
        );
        $terms = get_terms( $args );
    
        foreach($terms as $term) {
            $cid = get_field( 'cid', 'call_components_'.$term->term_id );
            $list[$term->term_id] = $cid.' '.$term->name;
        }
    	
        $field['choices'] = $list;
        return $field;
    	
    }
    add_filter('acf/load_field/name=component', 'render_component_field');
    

    Any help would appreciated.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.