Title: WP_REST_Attachments_Controller::get_collection_params
Published: December 6, 2016
Last modified: May 20, 2026

---

# WP_REST_Attachments_Controller::get_collection_params(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#wp--skip-link--target)

Retrieves the query params for collections of attachments.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#return)󠁿

 array Query parameters for the attachment collection as an array.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#source)󠁿

    ```php
    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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php#L1444)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php#L1444-L1470)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_REST_Attachments_Controller::get_media_types()](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_media_types/)`wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php` |

Retrieves the supported media types.

  | 
| [WP_REST_Posts_Controller::get_collection_params()](https://developer.wordpress.org/reference/classes/wp_rest_posts_controller/get_collection_params/)`wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php` |

Retrieves the query params for the posts collection.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/get_collection_params/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.9.0](https://developer.wordpress.org/reference/since/6.9.0/) | Extends the `media_type` and `mime_type` request arguments to support array values. | 
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_attachments_controller%2Fget_collection_params%2F)
before being able to contribute a note or feedback.