wp_error_added action-hookWP 5.6.0

Fires when an error is added to a WP_Error object.

Usage

add_action( 'wp_error_added', 'wp_kama_error_added_action', 10, 4 );

/**
 * Function for `wp_error_added` action-hook.
 * 
 * @param string|int $code     Error code.
 * @param string     $message  Error message.
 * @param mixed      $data     Error data. Might be empty.
 * @param WP_Error   $wp_error The WP_Error object.
 *
 * @return void
 */
function wp_kama_error_added_action( $code, $message, $data, $wp_error ){

	// action...
}
$code(string|int)
Error code.
$message(string)
Error message.
$data(mixed)
Error data. Might be empty.
$wp_error(WP_Error)
The WP_Error object.

Changelog

Since 5.6.0 Introduced.

Where the hook is called

WP_Error::add()
wp_error_added
wp-includes/class-wp-error.php 206
do_action( 'wp_error_added', $code, $message, $data, $this );

Where the hook is used in WordPress

Usage not found.