wppaste
WordPress

WP_REST_Posts_Controller::get_collection_params(): array

Since
4.7.0, 5.4.0, 5.7.0
Source
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:2974
Retrieves the query params for the posts collection.

Return

array
Collection parameters.

Hooks fired · 1

One hook fires while WP_REST_Posts_Controller::get_collection_params() runs, in this order:

  1. apply_filters( rest_{$this->post_type}_collection_params )filterline 3179 (+205 into the body)

    Filters collection parameters for the posts controller.

Uses · 8

Used by · 6

Source

	public function get_collection_params() {		$query_params = parent::get_collection_params(); 		$query_params['context']['default'] = 'view'; 		$query_params['after'] = array(			'description' => __( 'Limit response to posts published after a given ISO8601 compliant date.' ),			'type'        => 'string',			'format'      => 'date-time',		); 		$query_params['modified_after'] = array(			'description' => __( 'Limit response to posts modified after a given ISO8601 compliant date.' ),			'type'        => 'string',			'format'      => 'date-time',		); 		if ( post_type_supports( $this->post_type, 'author' ) ) {			$query_params['author']         = array(				'description' => __( 'Limit result set to posts assigned to specific authors.' ),				'type'        => 'array',				'items'       => array(					'type' => 'integer',				),				'default'     => array(),			);			$query_params['author_exclude'] = array(				'description' => __( 'Ensure result set excludes posts assigned to specific authors.' ),				'type'        => 'array',				'items'       => array(					'type' => 'integer',				),				'default'     => array(),			);		} 		$query_params['before'] = array(			'description' => __( 'Limit response to posts published before a given ISO8601 compliant date.' ),			'type'        => 'string',			'format'      => 'date-time',		); 		$query_params['modified_before'] = array(			'description' => __( 'Limit response to posts modified before a given ISO8601 compliant date.' ),			'type'        => 'string',			'format'      => 'date-time',		); 		$query_params['exclude'] = array(			'description' => __( 'Ensure result set excludes specific IDs.' ),			'type'        => 'array',			'items'       => array(				'type' => 'integer',			),			'default'     => array(),		); 		$query_params['include'] = array(			'description' => __( 'Limit result set to specific IDs.' ),			'type'        => 'array',			'items'       => array(				'type' => 'integer',			),			'default'     => array(),		); 		if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) {			$query_params['menu_order'] = array(				'description' => __( 'Limit result set to posts with a specific menu_order value.' ),				'type'        => 'integer',			);		} 		$query_params['search_semantics'] = array(			'description' => __( 'How to interpret the search input.' ),			'type'        => 'string',			'enum'        => array( 'exact' ),		); 		$query_params['offset'] = array(

History

Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.7.0
The modified_after and modified_before query parameters were added.from the docblock
5.4.0
The tax_relation query parameter was added.from the docblock
4.7.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.