acf_decode_taxonomy_terms()
acf_decode_taxonomy_terms
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 6.4.2
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;
}