Summery Summery
Initialize the error.
Syntax Syntax
Description Description
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.
Parameters Parameters
- $code
-
(Optional) Error code
Default value: ''
- $message
-
(Optional) Error message
Default value: ''
- $data
-
(Optional) Error data.
Default value: ''
Source Source
File: wp-includes/class-wp-error.php
public function __construct( $code = '', $message = '', $data = '' ) { if ( empty( $code ) ) { return; } $this->errors[ $code ][] = $message; if ( ! empty( $data ) ) { $this->error_data[ $code ] = $data; } }
Advertisement
Changelog Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |