WP_REST_Revisions_Controller::get_collection_params(): array

In this article

Retrieves the query params for collections.

Return

array Collection parameters.

Source

public function get_collection_params() {
	$query_params = parent::get_collection_params();

	$query_params['context']['default'] = 'view';

	unset( $query_params['per_page']['default'] );

	$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(),
	);

	$query_params['offset'] = array(
		'description' => __( 'Offset the result set by a specific number of items.' ),
		'type'        => 'integer',
	);

	$query_params['order'] = array(
		'description' => __( 'Order sort attribute ascending or descending.' ),
		'type'        => 'string',
		'default'     => 'desc',
		'enum'        => array( 'asc', 'desc' ),
	);

	$query_params['orderby'] = array(
		'description' => __( 'Sort collection by object attribute.' ),
		'type'        => 'string',
		'default'     => 'date',
		'enum'        => array(
			'date',
			'id',
			'include',
			'relevance',
			'slug',
			'include_slugs',
			'title',
		),
	);

	return $query_params;
}

Changelog

VersionDescription
4.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.