# get_allowed_mime_types()

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

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

## Сигнатура

```php
get_allowed_mime_types( int|WP_User $user = null ): string[]
```

## Описание

Возвращает список разрешённых MIME-типов и расширений файлов.

## Параметры

- `$user` `int|WP_User` — необязательный, по умолчанию `null`. Пользователь для проверки. По умолчанию — текущий пользователь.

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

`string[]`

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

Файл: `wp-includes/functions.php:3657`

```php
function get_allowed_mime_types( $user = null ) {
	$t = wp_get_mime_types();

	unset( $t['swf'], $t['exe'] );
	if ( function_exists( 'current_user_can' ) ) {
		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
	}

	if ( empty( $unfiltered ) ) {
		unset( $t['htm|html'], $t['js'] );
	}

	/**
	 * Filters the list of allowed mime types and file extensions.
	 *
	 * @since 2.0.0
	 *
	 * @param array            $t    Mime types keyed by the file extension regex corresponding to those types.
	 * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
	 */
	return apply_filters( 'upload_mimes', $t, $user );
}
```

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

- 2.8.6 — Introduced.

## Связанные

Использует: [`user_can`](https://chugunov.pro/api-wordpress/functions/user_can/), [`wp_get_mime_types`](https://chugunov.pro/api-wordpress/functions/wp_get_mime_types/), [`current_user_can`](https://chugunov.pro/api-wordpress/functions/current_user_can/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`get_default_block_editor_settings`](https://chugunov.pro/api-wordpress/functions/get_default_block_editor_settings/), [`populate_network_meta`](https://chugunov.pro/api-wordpress/functions/populate_network_meta/), `WP_REST_Attachments_Controller::get_media_types`, [`download_url`](https://chugunov.pro/api-wordpress/functions/download_url/), [`sanitize_file_name`](https://chugunov.pro/api-wordpress/functions/sanitize_file_name/), [`wp_check_filetype`](https://chugunov.pro/api-wordpress/functions/wp_check_filetype/), [`wp_check_filetype_and_ext`](https://chugunov.pro/api-wordpress/functions/wp_check_filetype_and_ext/), [`atom_enclosure`](https://chugunov.pro/api-wordpress/functions/atom_enclosure/), [`wp_plupload_default_settings`](https://chugunov.pro/api-wordpress/functions/wp_plupload_default_settings/), [`wp_enqueue_media`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_media/).

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