get_available_post_mime_types( string $type = 'attachment' ): string[]

Gets all available post MIME types for a given post type.


Parameters

$type string Optional

Default: 'attachment'


Top ↑

Return

string[] An array of MIME types.


Top ↑

Source

File: wp-includes/post.php. View all references

function get_available_post_mime_types( $type = 'attachment' ) {
	global $wpdb;

	$types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type ) );
	return $types;
}


Top ↑

Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes

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