WC_REST_Terms_Controller::get_taxonomy()protectedWC 1.0

Get taxonomy.

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

Хуков нет.

Возвращает

int|WP_Error.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_taxonomy( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код WC_REST_Terms_Controller::get_taxonomy() WC 8.7.0

protected function get_taxonomy( $request ) {
	$attribute_id = $request['attribute_id'];

	if ( empty( $attribute_id ) ) {
		return $this->taxonomy;
	}

	if ( isset( $this->taxonomies_by_id[ $attribute_id ] ) ) {
		return $this->taxonomies_by_id[ $attribute_id ];
	}

	$taxonomy = WC()->call_function( 'wc_attribute_taxonomy_name_by_id', (int) $request['attribute_id'] );
	if ( ! empty( $taxonomy ) ) {
		$this->taxonomy                          = $taxonomy;
		$this->taxonomies_by_id[ $attribute_id ] = $taxonomy;
	}

	return $taxonomy;
}