# is_protected_ajax_action()

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

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

## Сигнатура

```php
is_protected_ajax_action(): bool
```

## Описание

Определяет, обрабатываем ли мы сейчас Ajax-действие, которое следует защищать от «белого экрана смерти» (WSOD).

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

`bool`

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

Файл: `wp-includes/load.php:1218`

```php
function is_protected_ajax_action() {
	if ( ! wp_doing_ajax() ) {
		return false;
	}

	if ( ! isset( $_REQUEST['action'] ) ) {
		return false;
	}

	$actions_to_protect = array(
		'edit-theme-plugin-file', // Saving changes in the core code editor.
		'heartbeat',              // Keep the heart beating.
		'install-plugin',         // Installing a new plugin.
		'install-theme',          // Installing a new theme.
		'search-plugins',         // Searching in the list of plugins.
		'search-install-plugins', // Searching for a plugin in the plugin install screen.
		'update-plugin',          // Update an existing plugin.
		'update-theme',           // Update an existing theme.
		'activate-plugin',        // Activating an existing plugin.
	);

	/**
	 * Filters the array of protected Ajax actions.
	 *
	 * This filter is only fired when doing Ajax and the Ajax request has an 'action' property.
	 *
	 * @since 5.2.0
	 *
	 * @param string[] $actions_to_protect Array of strings with Ajax actions to protect.
	 */
	$actions_to_protect = (array) apply_filters( 'wp_protected_ajax_actions', $actions_to_protect );

	if ( ! in_array( $_REQUEST['action'], $actions_to_protect, true ) ) {
		return false;
	}

	return true;
}
```

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

- 5.2.0 — Introduced.

## Связанные

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

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