[ Index ]

WordPress 5.4.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    




/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.

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.

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

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

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

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

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.

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

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

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

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

return: bool

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

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.

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.

param: string|int $code Error code.

Generated: Tue May 19 15:51:04 2020 Cross-referenced by PHPXref 0.7.1