acf_decode_taxonomy_terms() ACF 5.0.0
This function decodes the $taxonomy:$term strings into a nested array
Хуков нет.
Возвращает
(Массив).
Использование
acf_decode_taxonomy_terms( $strings );
- $strings **
- -
По умолчанию: false
Список изменений
С версии 5.0.0 | Введена. |
Код acf_decode_taxonomy_terms() acf decode taxonomy terms ACF 5.9.1
function acf_decode_taxonomy_terms( $strings = false ) {
// bail early if no terms
if( empty($strings) ) return false;
// vars
$terms = array();
// loop
foreach( $strings as $string ) {
// vars
$data = acf_decode_taxonomy_term( $string );
$taxonomy = $data['taxonomy'];
$term = $data['term'];
// create empty array
if( !isset($terms[ $taxonomy ]) ) {
$terms[ $taxonomy ] = array();
}
// append
$terms[ $taxonomy ][] = $term;
}
// return
return $terms;
}