Automattic\WooCommerce\StoreApi\Schemas\V1

TermSchema::get_item_response()publicWC 1.0

Convert a term object into an object suitable for the response.

Метод класса: TermSchema{}

Хуков нет.

Возвращает

Массив.

Использование

$TermSchema = new TermSchema();
$TermSchema->get_item_response( $term );
$term(\WP_Term) (обязательный)
Term object.

Код TermSchema::get_item_response() WC 8.7.0

public function get_item_response( $term ) {
	return [
		'id'          => (int) $term->term_id,
		'name'        => $this->prepare_html_response( $term->name ),
		'slug'        => $term->slug,
		'description' => $this->prepare_html_response( $term->description ),
		'parent'      => (int) $term->parent,
		'count'       => (int) $term->count,
	];
}