get_available_post_mime_types() WordPress Function
The get_available_post_mime_types() function retrieves a list of all the available post mime types for the current site. This can be useful for restricting the allowed file types for a particular post type.
get_available_post_mime_types( string $type = 'attachment' ) #
Get all available post MIME types for a given post type.
Parameters
- $type
(string)(Optional)
Default value: 'attachment'
Return
(mixed)
Source
File: wp-includes/post.php
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |