WP_Error::get_error_data() WordPress Method
The WP_Error::get_error_data() method is used to retrieve the data associated with an error. This can be useful for debugging purposes.
WP_Error::get_error_data( string|int $code = '' ) #
Retrieves the most recently added error data for an error code.
Parameters
- $code
(string|int)(Optional) Error code.
Default value: ''
Return
(mixed) Error data, if it exists.
Source
File: wp-includes/class-wp-error.php
public function get_error_data( $code = '' ) {
if ( empty( $code ) ) {
$code = $this->get_error_code();
}
if ( isset( $this->error_data[ $code ] ) ) {
return $this->error_data[ $code ];
}
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |