[ Index ]

PHP Cross Reference of WordPress




/wp-includes/ -> class-wp-error.php (summary)

WordPress Error API. Contains the WP_Error class and the is_wp_error() function.

File Size: 226 lines (5 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Error:: (10 methods):

Class: WP_Error  - X-Ref

WordPress Error class.

Container for checking for WordPress errors and error messages. Return
WP_Error and use is_wp_error() to check if this class is returned. Many
core WordPress functions pass this class in the event of an error and
if not handled properly will result in code errors.

__construct( $code = '', $message = '', $data = '' )   X-Ref
Initialize the error.

If `$code` is empty, the other parameters will be ignored.
When `$code` is not empty, `$message` will be used even if
it is empty. The `$data` parameter will be used only if it
is not empty.

Though the class is constructed with a single error code and
message, multiple codes can be added using the `add()` method.

since: 2.1.0
param: string|int $code Error code
param: string $message Error message
param: mixed $data Optional. Error data.

get_error_codes()   X-Ref
Retrieve all error codes.

return: array List of error codes, if available.
since: 2.1.0

get_error_code()   X-Ref
Retrieve first error code available.

return: string|int Empty string, if no error codes.
since: 2.1.0

get_error_messages( $code = '' )   X-Ref
Retrieve all error messages or error messages matching code.

return: array Error strings on success, or empty array on failure (if using code parameter).
since: 2.1.0
param: string|int $code Optional. Retrieve messages matching code, if exists.

get_error_message( $code = '' )   X-Ref
Get single error message.

This will get the first message available for the code. If no code is
given then the first code available will be used.

return: string
since: 2.1.0
param: string|int $code Optional. Error code to retrieve message.

get_error_data( $code = '' )   X-Ref
Retrieve error data for error code.

return: mixed Error data, if it exists.
since: 2.1.0
param: string|int $code Optional. Error code.

has_errors()   X-Ref
Verify if the instance contains errors.

return: bool
since: 5.1.0

add( $code, $message, $data = '' )   X-Ref
Add an error or append additional message to an existing error.

since: 2.1.0
param: string|int $code Error code.
param: string $message Error message.
param: mixed $data Optional. Error data.

add_data( $data, $code = '' )   X-Ref
Add data for error code.

The error code can only contain one error data.

since: 2.1.0
param: mixed $data Error data.
param: string|int $code Error code.

remove( $code )   X-Ref
Removes the specified error.

This function removes all error messages associated with the specified
error code, along with any error data for that code.

since: 4.1.0
param: string|int $code Error code.

Generated: Sat Jul 4 01:00:03 2020 Cross-referenced by PHPXref 0.7.1