pre_get_available_post_mime_types
Filters the list of available post MIME types for the given post type.
Usage
add_filter( 'pre_get_available_post_mime_types', 'wp_kama_pre_get_available_post_mime_types_filter', 10, 2 ); /** * Function for `pre_get_available_post_mime_types` filter-hook. * * @param string[]|null $mime_types An array of MIME types. * @param string $type The post type name. Usually 'attachment' but can be any post type. * * @return string[]|null */ function wp_kama_pre_get_available_post_mime_types_filter( $mime_types, $type ){ // filter... return $mime_types; }
- $mime_types(string[]|null)
- An array of MIME types.
Default: null - $type(string)
- The post type name. Usually 'attachment' but can be any post type.
Changelog
Since 6.4.0 | Introduced. |
Where the hook is called
pre_get_available_post_mime_types
wp-includes/post.php 8094
$mime_types = apply_filters( 'pre_get_available_post_mime_types', null, $type );