WordPress at a glance
function is not described

WP_REST_Attachments_Controller::get_media_types() protected WP 4.7.0

Retrieves the supported media types.

Media types are considered the MIME type category.

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

No Hooks.

Return

Array. Array of supported media types.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_media_types();

Changelog

Since 4.7.0 Introduced.

Code of WP_REST_Attachments_Controller::get_media_types() WP 5.5.1

<?php
protected function get_media_types() {
	$media_types = array();

	foreach ( get_allowed_mime_types() as $mime_type ) {
		$parts = explode( '/', $mime_type );

		if ( ! isset( $media_types[ $parts[0] ] ) ) {
			$media_types[ $parts[0] ] = array();
		}

		$media_types[ $parts[0] ][] = $mime_type;
	}

	return $media_types;
}