WP_Error::add

Advertisement

Summery Summery

Add an error or append additional message to an existing error.

Syntax Syntax

WP_Error::add( string|int $code, string $message, mixed $data = '' )

Parameters Parameters

$code

(Required) Error code.

$message

(Required) Error message.

$data

(Optional) Error data.

Default value: ''

Source Source

File: wp-includes/class-wp-error.php

	public function add( $code, $message, $data = '' ) {
		$this->errors[ $code ][] = $message;
		if ( ! empty( $data ) ) {
			$this->error_data[ $code ] = $data;
		}
	}

Advertisement

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Advertisement

Leave a Reply