wp_error_added
Action HookDescription
Fires when an error is added to a WP_Error object.Hook Information
File Location |
wp-includes/class-wp-error.php
View on GitHub
|
Hook Type | Action |
Line Number | 209 |
Hook Parameters
Type | Name | Description |
---|---|---|
string|int
|
$code
|
Error code. |
string
|
$message
|
Error message. |
mixed
|
$data
|
Error data. Might be empty. |
WP_Error
|
$wp_error
|
The WP_Error object. |
Usage Examples
Basic Usage
<?php
// Hook into wp_error_added
add_action('wp_error_added', 'my_custom_function', 10, 4);
function my_custom_function($code, $message, $data, $wp_error) {
// Your custom code here
}
Source Code Context
wp-includes/class-wp-error.php:209
- How this hook is used in WordPress core
<?php
204 * @param string|int $code Error code.
205 * @param string $message Error message.
206 * @param mixed $data Error data. Might be empty.
207 * @param WP_Error $wp_error The WP_Error object.
208 */
209 do_action( 'wp_error_added', $code, $message, $data, $this );
210 }
211
212 /**
213 * Adds data to an error with the given code.
214 *
PHP Documentation
<?php
/**
* Fires when an error is added to a WP_Error object.
*
* @since 5.6.0
*
* @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.
*/
Quick Info
- Hook Type: Action
- Parameters: 4
- File: wp-includes/class-wp-error.php
Related Hooks
Related hooks will be displayed here in future updates.