pre_get_available_post_mime_types
Filters the list of available post MIME types for the given post type.
Использование
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.
По умолчанию: null - $type(строка)
- The post type name. Usually 'attachment' but can be any post type.
Список изменений
| С версии 6.4.0 | Введена. |
Где вызывается хук
pre_get_available_post_mime_types
wp-includes/post.php 8658
$mime_types = apply_filters( 'pre_get_available_post_mime_types', null, $type );