acf_field_taxonomy::get_terms() public ACF 5.0.0
This function will return an array of terms for a given field value
{} Это метод класса: acf_field_taxonomy{}
Хуков нет.
Возвращает
$value.
Использование
$acf_field_taxonomy = new acf_field_taxonomy(); $acf_field_taxonomy->get_terms( $value, $taxonomy );
- (array)($value) (обязательный)
Список изменений
С версии 5.0.0 | Введена. |
Код acf_field_taxonomy::get_terms() acf field taxonomy::get terms ACF 5.9.1
function get_terms( $value, $taxonomy = 'category' ) {
// load terms in 1 query to save multiple DB calls from following code
if( count($value) > 1 ) {
$terms = acf_get_terms(array(
'taxonomy' => $taxonomy,
'include' => $value,
'hide_empty' => false
));
}
// update value to include $post
foreach( array_keys($value) as $i ) {
$value[ $i ] = get_term( $value[ $i ], $taxonomy );
}
// filter out null values
$value = array_filter($value);
// return
return $value;
}