# get_available_post_mime_types()

URL: https://chugunov.pro/api-wordpress/functions/get_available_post_mime_types/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 2.5.0.

## Сигнатура

```php
get_available_post_mime_types( string $type = 'attachment' ): string[]
```

## Описание

Получает все доступные MIME-типы записей для заданного типа записи.

## Параметры

- `$type` `string` — необязательный, по умолчанию `'attachment'`. По умолчанию: 'attachment'

## Возвращаемое значение

`string[]`

## Исходный код

Файл: `wp-includes/post.php:8424`

```php
function get_available_post_mime_types( $type = 'attachment' ) {
	global $wpdb;

	/**
	 * Filters the list of available post MIME types for the given post type.
	 *
	 * @since 6.4.0
	 *
	 * @param string[]|null $mime_types An array of MIME types. Default null.
	 * @param string        $type       The post type name. Usually 'attachment' but can be any post type.
	 */
	$mime_types = apply_filters( 'pre_get_available_post_mime_types', null, $type );

	if ( ! is_array( $mime_types ) ) {
		$mime_types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s AND post_mime_type != ''", $type ) );
	}

	// Remove nulls from returned $mime_types.
	return array_values( array_filter( $mime_types ) );
}
```

## История изменений

- 2.5.0 — Introduced.

## Связанные

Использует: `wpdb::get_col`, [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), `wpdb::prepare`.
Используется в: [`wp_edit_attachments_query`](https://chugunov.pro/api-wordpress/functions/wp_edit_attachments_query/), `WP_Query`.

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/get_available_post_mime_types/
