WP_REST_Attachments_Controller::get_media_types()

Retrieves the supported media types.


Description Description

Media types are considered the MIME type category.


Return Return

(array) Array of supported media types.


Top ↑

Source Source

File: wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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