WP_REST_Templates_Controller::get_collection_params() WordPress Method

The WP_REST_Templates_Controller::get_collection_params() method allows developers to specify the parameters that will be used to retrieve a collection of templates from the WordPress REST API. This method can be used to specify the order in which the templates will be returned, the number of templates to return, and the fields to include in the response.

WP_REST_Templates_Controller::get_collection_params() #

Retrieves the query params for the posts collection.


Return

(array) Collection parameters.


Top ↑

Source

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

	public function get_collection_params() {
		return array(
			'context'   => $this->get_context_param( array( 'default' => 'view' ) ),
			'wp_id'     => array(
				'description' => __( 'Limit to the specified post id.' ),
				'type'        => 'integer',
			),
			'area'      => array(
				'description' => __( 'Limit to the specified template part area.' ),
				'type'        => 'string',
			),
			'post_type' => array(
				'description' => __( 'Post type to get the templates for.' ),
				'type'        => 'string',
			),
		);
	}


Top ↑

Changelog

Changelog
VersionDescription
5.9.0Added 'area' and 'post_type'.
5.8.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.