WP_REST_Attachments_Controller::get_collection_params(): array
- Since
- 4.7.0, 6.9.0
- Source
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php:1361
Retrieves the query params for collections of attachments.
Return
array- Query parameters for the attachment collection as an array.
Uses · 3
- __()Retrieves the translation of $text.
- WP_REST_Posts_Controller::get_collection_params()Retrieves the query params for the posts collection.
- WP_REST_Attachments_Controller::get_media_types()Retrieves the supported media types.
Source
public function get_collection_params() { $params = parent::get_collection_params(); $params['status']['default'] = 'inherit'; $params['status']['items']['enum'] = array( 'inherit', 'private', 'trash' ); $media_types = array_keys( $this->get_media_types() ); $params['media_type'] = array( 'default' => null, 'description' => __( 'Limit result set to attachments of a particular media type or media types.' ), 'type' => 'array', 'items' => array( 'type' => 'string', 'enum' => $media_types, ), ); $params['mime_type'] = array( 'default' => null, 'description' => __( 'Limit result set to attachments of a particular MIME type or MIME types.' ), 'type' => 'array', 'items' => array( 'type' => 'string', ), ); return $params; }History
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.9.0
Extends the
media_type and mime_type request arguments to support array values.from the docblock4.7.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-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.