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.
Source
File: wp-includes/rest-api/fields/class-wp-rest-term-meta-fields.php
public function __construct( $taxonomy ) { $this->taxonomy = $taxonomy; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |