Title: _wp_die_process_input
Published: February 22, 2019
Last modified: February 24, 2026

---

# _wp_die_process_input( string|WP_Error $message, string $title, string|array $args = array() ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Processes arguments passed to [wp_die()](https://developer.wordpress.org/reference/functions/wp_die/)
consistently for its handlers.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#parameters)󠁿

 `$message`string|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
required

Error message or [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
object.

`$title`stringoptional

Error title. Default empty string.

`$args`string|arrayoptional

Arguments to control behavior.

Default:`array()`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#return)󠁿

 array Processed arguments.

 * `0` string
 * Error message.
 * `1` string
 * Error title.
 * `2` array
 * Arguments to control behavior.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#source)󠁿

    ```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 );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/functions.php#L4296)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/functions.php#L4296-L4369)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#related)󠁿

| Uses | Description | 
| [_canonical_charset()](https://developer.wordpress.org/reference/functions/_canonical_charset/)`wp-includes/functions.php` |

Retrieves a canonical form of the provided charset appropriate for passing to PHP functions such as htmlspecialchars() and charset HTML attributes.

  | 
| [is_rtl()](https://developer.wordpress.org/reference/functions/is_rtl/)`wp-includes/l10n.php` |

Determines whether the current locale is right-to-left (RTL).

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [wp_parse_args()](https://developer.wordpress.org/reference/functions/wp_parse_args/)`wp-includes/functions.php` |

Merges user defined arguments into defaults array.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#)

| Used by | Description | 
| [_jsonp_wp_die_handler()](https://developer.wordpress.org/reference/functions/_jsonp_wp_die_handler/)`wp-includes/functions.php` |

Kills WordPress execution and displays JSONP response with an error message.

  | 
| [_xml_wp_die_handler()](https://developer.wordpress.org/reference/functions/_xml_wp_die_handler/)`wp-includes/functions.php` |

Kills WordPress execution and displays XML response with an error message.

  | 
| [_json_wp_die_handler()](https://developer.wordpress.org/reference/functions/_json_wp_die_handler/)`wp-includes/functions.php` |

Kills WordPress execution and displays JSON response with an error message.

  | 
| [_scalar_wp_die_handler()](https://developer.wordpress.org/reference/functions/_scalar_wp_die_handler/)`wp-includes/functions.php` |

Kills WordPress execution and displays an error message.

  | 
| [_default_wp_die_handler()](https://developer.wordpress.org/reference/functions/_default_wp_die_handler/)`wp-includes/functions.php` |

Kills WordPress execution and displays HTML page with an error message.

  | 
| [_ajax_wp_die_handler()](https://developer.wordpress.org/reference/functions/_ajax_wp_die_handler/)`wp-includes/functions.php` |

Kills WordPress execution and displays Ajax response with an error message.

  | 
| [_xmlrpc_wp_die_handler()](https://developer.wordpress.org/reference/functions/_xmlrpc_wp_die_handler/)`wp-includes/functions.php` |

Kills WordPress execution and displays XML response with an error message.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/_wp_die_process_input/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2F_wp_die_process_input%2F)
before being able to contribute a note or feedback.