wpseek.com
A WordPress-centric search engine for devs and theme authors



get_available_post_mime_types › WordPress Function

Since2.5.0
Deprecatedn/a
get_available_post_mime_types ( $type = 'attachment' )
Parameters:
  • (string) $type
    Required: No
    Default: 'attachment'
Returns:
  • (string[]) An array of MIME types.
Defined at:
Codex:

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