WP_REST_Terms_Controller::check_is_taxonomy_allowed() WordPress Method

The WP_REST_Terms_Controller::check_is_taxonomy_allowed() method is used to check if a given taxonomy is allowed for the current request. This is a utility method used by the various endpoints that work with terms.

WP_REST_Terms_Controller::check_is_taxonomy_allowed( string $taxonomy ) #

Checks that the taxonomy is valid.


Parameters

$taxonomy

(string)(Required)Taxonomy to check.


Top ↑

Return

(bool) Whether the taxonomy is allowed for REST management.


Top ↑

Source

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

	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;
	}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.