acf_get_taxonomies_for_post_type()
acf_get_taxonomies_for_post_type
Returns an array of taxonomies for a given post type(s)
Хуков нет.
Возвращает
Массив
.
Использование
acf_get_taxonomies_for_post_type( $post_types );
- $post_types(строка|массив)
- The post types to compare against.
По умолчанию: 'post'
Список изменений
С версии 5.7.5 | Введена. |
Код acf_get_taxonomies_for_post_type() acf get taxonomies for post type ACF 6.0.4
function acf_get_taxonomies_for_post_type( $post_types = 'post' ) { // vars $taxonomies = array(); // loop foreach ( (array) $post_types as $post_type ) { $object_taxonomies = get_object_taxonomies( $post_type ); foreach ( (array) $object_taxonomies as $taxonomy ) { $taxonomies[] = $taxonomy; } } // remove duplicates $taxonomies = array_unique( $taxonomies ); // return return $taxonomies; }