WP_REST_Terms_Controller::check_is_taxonomy_allowed()protectedWP 4.7.0

Checks that the taxonomy is valid.

Method of the class: WP_REST_Terms_Controller{}

No Hooks.

Return

true|false. Whether the taxonomy is allowed for REST management.

Usage

// protected - for code of main (parent) or child class
$result = $this->check_is_taxonomy_allowed( $taxonomy );
$taxonomy(string) (required)
Taxonomy to check.

Changelog

Since 4.7.0 Introduced.

WP_REST_Terms_Controller::check_is_taxonomy_allowed() code WP 6.5.2

protected function check_is_taxonomy_allowed( $taxonomy ) {
	$taxonomy_obj = get_taxonomy( $taxonomy );
	if ( $taxonomy_obj && ! empty( $taxonomy_obj->show_in_rest ) ) {
		return true;
	}
	return false;
}