WPDev.one
Core Class

WP_Error

class WP_Error // Constructor: function Object() { [native code] }

WordPress Error class.

Methods 14 methods

Method / Return Description
__construct()
void

Initializes the error.

Parameters: $code: mixed, $message: mixed, $data: mixed
get_error_codes()
array

Retrieves all error codes.

get_error_code()
(string

Retrieves the first error code available.

get_error_messages()
string[]

Retrieves all error messages, or the error messages for the given error code.

Parameters: $code: mixed
get_error_message()
string

Gets a single error message.

Parameters: $code: mixed
get_error_data()
mixed

Retrieves the most recently added error data for an error code.

Parameters: $code: mixed
has_errors()
bool

Verifies if the instance contains errors.

add()
void

Adds an error or appends an additional message to an existing error.

Parameters: $code: mixed, $message: mixed, $data: mixed
add_data()
void

Adds data to an error with the given code.

Parameters: $data: mixed, $code: mixed
get_all_error_data()
mixed[]

Retrieves all error data for an error code in the order in which the data was added.

Parameters: $code: mixed
remove()
void

Removes the specified error.

Parameters: $code: mixed
merge_from()
void

Merges the errors in the given error object into this one.

Parameters: $error: WP_Error
export_to()
void

Exports the errors in this object into the given one.

Parameters: $error: WP_Error
copy_errors()
void

Copies errors from one WP_Error instance to another.

Parameters: $from: WP_Error, $to: WP_Error

Properties

Property / Type Description
$errors
mixed
public
No description available.
$error_data
mixed
public
No description available.
$additional_data
mixed
public
No description available.

Class Information

Since Version
2.1.0
Source File
wp-includes/class-wp-error.php
Advertisement