Automattic\WooCommerce\Blocks\BlockTypes
FeaturedCategory::get_item()
Returns the featured category.
Метод класса: FeaturedCategory{}
Хуков нет.
Возвращает
\WP_Term|null
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_item( $attributes );
- $attributes(массив) (обязательный)
- Block attributes.
По умолчанию: empty array
Код FeaturedCategory::get_item() FeaturedCategory::get item WC 7.5.1
protected function get_item( $attributes ) { $id = absint( $attributes['categoryId'] ?? 0 ); $category = get_term( $id, 'product_cat' ); if ( ! $category || is_wp_error( $category ) ) { return null; } return $category; }