WP_REST_Term_Meta_Fields::__construct() WordPress Method

The WP_REST_Term_Meta_Fields::__construct() function allows you to add custom fields to terms in the WordPress REST API. This function is useful for adding extra data to terms, such as custom fields, that you want to be able to access via the REST API.

WP_REST_Term_Meta_Fields::__construct( string $taxonomy ) #

Constructor.


Parameters

$taxonomy

(string)(Required)Taxonomy to register fields for.


Top ↑

Source

File: wp-includes/rest-api/fields/class-wp-rest-term-meta-fields.php

	public function __construct( $taxonomy ) {
		$this->taxonomy = $taxonomy;
	}


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.