Automattic\WooCommerce\Internal\ProductAttributesLookup
LookupDataStore::get_term_ids_by_slug_cache()
Get a cache of term ids by slug for a set of taxonomies, with this format:
[ 'taxonomy' => ['slug_1' => id_1, 'slug_2' => id_2, ...
], ... ]
Метод класса: LookupDataStore{}
Хуков нет.
Возвращает
Массив
. A dictionary of taxonomies => dictionary of term slug => term id.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_term_ids_by_slug_cache( $taxonomies );
- $taxonomies(массив) (обязательный)
- List of taxonomies to build the cache for.
Код LookupDataStore::get_term_ids_by_slug_cache() LookupDataStore::get term ids by slug cache WC 8.7.0
private function get_term_ids_by_slug_cache( $taxonomies ) { $result = array(); foreach ( $taxonomies as $taxonomy ) { $terms = WC()->call_function( 'get_terms', array( 'taxonomy' => wc_sanitize_taxonomy_name( $taxonomy ), 'hide_empty' => false, 'fields' => 'id=>slug', ) ); $result[ $taxonomy ] = array_flip( $terms ); } return $result; }