WP_REST_Menu_Items_Controller::get_collection_params()publicWP 5.9.0

Retrieves the query params for the posts collection.

{} It's a method of the class: WP_REST_Menu_Items_Controller{}

No Hooks.

Return

Array. Collection parameters.

Usage

$WP_REST_Menu_Items_Controller = new WP_REST_Menu_Items_Controller();
$WP_REST_Menu_Items_Controller->get_collection_params();

Changelog

Since 5.9.0 Introduced.

Code of WP_REST_Menu_Items_Controller::get_collection_params() WP 6.0

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

	$query_params['menu_order'] = array(
		'description' => __( 'Limit result set to posts with a specific menu_order value.' ),
		'type'        => 'integer',
	);

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

	$query_params['orderby'] = array(
		'description' => __( 'Sort collection by object attribute.' ),
		'type'        => 'string',
		'default'     => 'menu_order',
		'enum'        => array(
			'author',
			'date',
			'id',
			'include',
			'modified',
			'parent',
			'relevance',
			'slug',
			'include_slugs',
			'title',
			'menu_order',
		),
	);
	// Change default to 100 items.
	$query_params['per_page']['default'] = 100;

	return $query_params;
}