# _wp_die_process_input()

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

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

## Сигнатура

```php
_wp_die_process_input( string|WP_Error $message, string $title = '', string|array $args = array() ): array
```

## Описание

Единообразно обрабатывает аргументы, передаваемые в wp_die(), для его обработчиков.

## Параметры

- `$message` `string|WP_Error` — обязательный. Сообщение об ошибке или объект WP_Error.
- `$title` `string` — необязательный, по умолчанию `''`. Заголовок ошибки.
- `$args` `string|array` — необязательный, по умолчанию `array()`. Аргументы, управляющие поведением.

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

`array` — 0 stringСообщение об ошибке. 1 stringЗаголовок ошибки. 2 arrayАргументы для управления поведением.

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

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

```php
function _wp_die_process_input( $message, $title = '', $args = array() ) {
	$defaults = array(
		'response'          => 0,
		'code'              => '',
		'exit'              => true,
		'back_link'         => false,
		'link_url'          => '',
		'link_text'         => '',
		'text_direction'    => '',
		'charset'           => 'utf-8',
		'additional_errors' => array(),
	);

	$args = wp_parse_args( $args, $defaults );

	if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
		if ( ! empty( $message->errors ) ) {
			$errors = array();
			foreach ( (array) $message->errors as $error_code => $error_messages ) {
				foreach ( (array) $error_messages as $error_message ) {
					$errors[] = array(
						'code'    => $error_code,
						'message' => $error_message,
						'data'    => $message->get_error_data( $error_code ),
					);
				}
			}

			$message = $errors[0]['message'];
			if ( empty( $args['code'] ) ) {
				$args['code'] = $errors[0]['code'];
			}
			if ( empty( $args['response'] ) && is_array( $errors[0]['data'] ) && ! empty( $errors[0]['data']['status'] ) ) {
				$args['response'] = $errors[0]['data']['status'];
			}
			if ( empty( $title ) && is_array( $errors[0]['data'] ) && ! empty( $errors[0]['data']['title'] ) ) {
				$title = $errors[0]['data']['title'];
			}
			if ( WP_DEBUG_DISPLAY && is_array( $errors[0]['data'] ) && ! empty( $errors[0]['data']['error'] ) ) {
				$args['error_data'] = $errors[0]['data']['error'];
			}

			unset( $errors[0] );
			$args['additional_errors'] = array_values( $errors );
		} else {
			$message = '';
		}
	}

	$have_gettext = function_exists( '__' );

	// The $title and these specific $args must always have a non-empty value.
	if ( empty( $args['code'] ) ) {
		$args['code'] = 'wp_die';
	}
	if ( empty( $args['response'] ) ) {
		$args['response'] = 500;
	}
	if ( empty( $title ) ) {
		$title = $have_gettext ? __( 'WordPress &rsaquo; Error' ) : 'WordPress &rsaquo; Error';
	}
	if ( empty( $args['text_direction'] ) || ! in_array( $args['text_direction'], array( 'ltr', 'rtl' ), true ) ) {
		$args['text_direction'] = 'ltr';
		if ( function_exists( 'is_rtl' ) && is_rtl() ) {
			$args['text_direction'] = 'rtl';
		}
	}

	if ( ! empty( $args['charset'] ) ) {
		$args['charset'] = _canonical_charset( $args['charset'] );
	}

	return array( $message, $title, $args );
}
```

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

- 5.1.0 — Introduced.

## Связанные

Использует: [`_canonical_charset`](https://chugunov.pro/api-wordpress/functions/_canonical_charset/), [`is_rtl`](https://chugunov.pro/api-wordpress/functions/is_rtl/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`wp_parse_args`](https://chugunov.pro/api-wordpress/functions/wp_parse_args/), [`is_wp_error`](https://chugunov.pro/api-wordpress/functions/is_wp_error/).
Используется в: [`_jsonp_wp_die_handler`](https://chugunov.pro/api-wordpress/functions/_jsonp_wp_die_handler/), [`_xml_wp_die_handler`](https://chugunov.pro/api-wordpress/functions/_xml_wp_die_handler/), [`_json_wp_die_handler`](https://chugunov.pro/api-wordpress/functions/_json_wp_die_handler/), [`_scalar_wp_die_handler`](https://chugunov.pro/api-wordpress/functions/_scalar_wp_die_handler/), [`_default_wp_die_handler`](https://chugunov.pro/api-wordpress/functions/_default_wp_die_handler/), [`_ajax_wp_die_handler`](https://chugunov.pro/api-wordpress/functions/_ajax_wp_die_handler/), [`_xmlrpc_wp_die_handler`](https://chugunov.pro/api-wordpress/functions/_xmlrpc_wp_die_handler/).

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