GC_Error::add()
最后更新于:2021-11-27 14:42:11
GC_Error::add( string|int$code, string$message, mixed$data=”)Adds an error or appends an additional message to an existing error.
参数
- $code
-
(string|int) (Required) Error code.
- $message
-
(string) (Required) Error message.
- $data
-
(mixed) (Optional) Error data.
Default value: ”
源文件
文件: gc-includes/class-gc-error.php
public function add( $code, $message, $data = '' ) {
$this->errors[ $code ][] = $message;
if ( ! empty( $data ) ) {
$this->add_data( $data, $code );
}
/**
* Fires when an error is added to a GC_Error object.
*
* @since 5.6.0
*
* @param string|int $code Error code.
* @param string $message Error message.
* @param mixed $data Error data. Might be empty.
* @param GC_Error $gc_error The GC_Error object.
*/
do_action( 'gc_error_added', $code, $message, $data, $this );
}