_wp_die_process_input( string|WP_Error $message, string $title = '', string|array $args = array() ): array
- Since
- 5.1.0
- Source
wp-includes/functions.php:4296
Compatibility
- WordPress
- since 5.1.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$messagestring|WP_Error- Error message or WP_Error object.
$titlestringoptional- Error title. Default empty string.Default:
'' $argsstring|arrayoptional- Arguments to control behavior. Default empty array.Default:
array()
Return value
array- Processed arguments.
$0stringError message.$1stringError title.$2arrayArguments to control behavior.
Performance profile
How much work a call to _wp_die_process_input() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 33–116
- Plugin surface
- None
- Called by
- 7
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 151.
Nothing here hands control to plugin code.
7 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
do_action()one call below _wp_die_process_input()
Further down the call graph this can also reach option, cache, serialize, query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 36 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost _wp_die_process_input() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!function_exists() | 33–40 | wp_parse_args(), function_exists(), function_exists() |
!function_exists() && empty($args) | 36–46 | wp_parse_args(), function_exists(), function_exists(), function_exists() |
function_exists() | 37–47 | wp_parse_args(), function_exists(), is_wp_error(), function_exists() |
empty($args) | 39–51 | wp_parse_args(), function_exists(), function_exists(), function_exists(), is_rtl() |
!function_exists() && !empty($args) | 40–47 | wp_parse_args(), function_exists(), function_exists(), _canonical_charset() |
empty($title) | 40–44 | wp_parse_args(), function_exists(), function_exists(), __() |
empty($args) | 40–53 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), function_exists() |
!function_exists() && !empty($args) | 43–53 | wp_parse_args(), function_exists(), function_exists(), function_exists(), _canonical_charset() |
empty($title) && empty($args) | 43–50 | wp_parse_args(), function_exists(), function_exists(), __(), function_exists() |
function_exists() && empty($args) | 43–58 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), function_exists(), is_rtl() |
function_exists() && !empty($args) | 44–54 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), _canonical_charset() |
function_exists() && empty($title) | 44–51 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), __() |
24 further outcomes, up to 116 instructions
!empty($args) | 46–58 | wp_parse_args(), function_exists(), function_exists(), function_exists(), is_rtl(), _canonical_charset() |
empty($title) && empty($args) | 46–55 | wp_parse_args(), function_exists(), function_exists(), __(), function_exists(), is_rtl() |
!empty($args) && empty($title) | 47–51 | wp_parse_args(), function_exists(), function_exists(), __(), _canonical_charset() |
!empty($args) | 47–60 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), function_exists(), _canonical_charset() |
empty($title) && empty($args) | 47–57 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), __(), function_exists() |
!empty($args) && empty($title) | 50–57 | wp_parse_args(), function_exists(), function_exists(), __(), function_exists(), _canonical_charset() |
function_exists() && !empty($args) | 50–65 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), function_exists(), is_rtl(), _canonical_charset() |
function_exists() && empty($title) && empty($args) | 50–62 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), __(), function_exists(), is_rtl() |
function_exists() && !empty($args) && empty($title) | 51–58 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), __(), _canonical_charset() |
!empty($args) && empty($title) | 53–62 | wp_parse_args(), function_exists(), function_exists(), __(), function_exists(), is_rtl(), _canonical_charset() |
!empty($args) && empty($title) | 54–64 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), __(), function_exists(), _canonical_charset() |
function_exists() && !empty($args) && empty($title) | 57–69 | wp_parse_args(), function_exists(), is_wp_error(), function_exists(), __(), function_exists(), is_rtl(), _canonical_charset() |
function_exists() && is_wp_error() && !empty($message) | 62–94 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists() |
is_wp_error() && !empty($message) | 65–100 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), function_exists() |
function_exists() && is_wp_error() && !empty($message) | 68–105 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), function_exists(), is_rtl() |
function_exists() && is_wp_error() && !empty($message) && !empty($args) | 69–101 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), _canonical_charset() |
function_exists() && is_wp_error() && !empty($message) && empty($title) | 69–98 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), __() |
is_wp_error() && !empty($message) && !empty($args) | 72–107 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), function_exists(), _canonical_charset() |
is_wp_error() && !empty($message) && empty($title) | 72–104 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), __(), function_exists() |
function_exists() && is_wp_error() && !empty($message) && !empty($args) | 75–112 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), function_exists(), is_rtl(), _canonical_charset() |
function_exists() && is_wp_error() && !empty($message) && empty($title) | 75–109 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), __(), function_exists(), is_rtl() |
function_exists() && is_wp_error() && !empty($message) && !empty($args) && empty($title) | 76–105 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), __(), _canonical_charset() |
is_wp_error() && !empty($message) && !empty($args) && empty($title) | 79–111 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), __(), function_exists(), _canonical_charset() |
function_exists() && is_wp_error() && !empty($message) && !empty($args) && empty($title) | 82–116 | wp_parse_args(), function_exists(), is_wp_error(), array_values(), function_exists(), __(), function_exists(), is_rtl(), _canonical_charset() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 150 | 33–115 | 26 | 1 fewer instruction than PHP 8.5 |
| 8.5 | 151 | 33–116 | 26 | |
| 8.4 | 151 | 33–116 | 26 | |
| 8.3 | 151 | 33–116 | 26 | |
| 8.2 | 151 | 33–116 | 26 | |
| 8.1 | 151 | 33–116 | 26 | |
| 7.4 | 151 | 33–116 | 26 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 5
- wp_parse_args()Merges user defined arguments into defaults array.
- is_wp_error()Checks whether the given variable is a WordPress Error.
- __()Retrieves the translation of $text.
- is_rtl()Determines whether the current locale is right-to-left (RTL).
- _canonical_charset()Retrieves a canonical form of the provided charset appropriate for passing to PHP functions such as htmlspecialchars() and charset HTML attributes.
Used by · 7
- _ajax_wp_die_handler()Kills WordPress execution and displays Ajax response with an error message.
- _default_wp_die_handler()Kills WordPress execution and displays HTML page with an error message.
- _json_wp_die_handler()Kills WordPress execution and displays JSON response with an error message.
- _jsonp_wp_die_handler()Kills WordPress execution and displays JSONP response with an error message.
- _scalar_wp_die_handler()Kills WordPress execution and displays an error message.
- _xml_wp_die_handler()Kills WordPress execution and displays XML response with an error message.
- _xmlrpc_wp_die_handler()Kills WordPress execution and displays XML response with an error message.
Source code
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 › Error' ) : 'WordPress › 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 );}Changelog
Introduced in 5.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.