acf_get_choices_from_grouped_terms()
acf_get_choices_from_grouped_terms
Returns an array of choices from the grouped terms provided.
Хуков нет.
Возвращает
Массив
.
Использование
acf_get_choices_from_grouped_terms( $value, $format );
- $value(массив) (обязательный)
- A grouped array of WP_Terms objects.
- $format(строка)
- The value format (term_id, slug).
По умолчанию: 'term_id'
Список изменений
С версии 5.7.5 | Введена. |
Код acf_get_choices_from_grouped_terms() acf get choices from grouped terms ACF 6.0.4
function acf_get_choices_from_grouped_terms( $value, $format = 'term_id' ) { // vars $groups = array(); // loop over values foreach ( $value as $group => $terms ) { $groups[ $group ] = array(); foreach ( $terms as $term_id => $term ) { $choice = acf_get_choice_from_term( $term, $format ); $groups[ $group ][ $choice['id'] ] = $choice['text']; } } // return return $groups; }