A WordPress-centric search engine for devs and theme authors



get_available_post_mime_types ›

Since2.5.0
Deprecatedn/a
get_available_post_mime_types ( $type = 'attachment' )
Parameters:
  • (string) $type
    Required: No
    Default: 'attachment'
Returns:
  • (mixed)
Defined at:
Codex:

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



Source

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