W3cubDocs

/WordPress

WP_REST_Terms_Controller::__construct( string $taxonomy )

Constructor.

Parameters

$taxonomy

(string) (Required) Taxonomy key.

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

public function __construct( $taxonomy ) {
		$this->taxonomy  = $taxonomy;
		$this->namespace = 'wp/v2';
		$tax_obj         = get_taxonomy( $taxonomy );
		$this->rest_base = ! empty( $tax_obj->rest_base ) ? $tax_obj->rest_base : $tax_obj->name;

		$this->meta = new WP_REST_Term_Meta_Fields( $taxonomy );
	}

Changelog

Version Description
4.7.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_terms_controller/__construct