acf_get_term()
acf_get_term
Similar to get_term() but with some extra functionality.
Хуков нет.
Возвращает
WP_Term.
Использование
acf_get_term( $term_id, $taxonomy );
- $term_id(разное) (обязательный)
- The term ID or a string of "taxonomy:slug".
- $taxonomy(строка)
- The taxonomyname.
По умолчанию: ''
Список изменений
| С версии 5.7.3 | Введена. |
Код acf_get_term() acf get term ACF 6.4.2
function acf_get_term( $term_id, $taxonomy = '' ) {
// allow $term_id parameter to be a string of "taxonomy:slug" or "taxonomy:id"
if ( is_string( $term_id ) && strpos( $term_id, ':' ) ) {
list( $taxonomy, $term_id ) = explode( ':', $term_id );
$term = get_term_by( 'slug', $term_id, $taxonomy );
if ( $term ) {
return $term;
}
}
// return
return get_term( $term_id, $taxonomy );
}