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

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


Description Description


Parameters Parameters

$code

(string|int) (Required) Error code.

$message

(string) (Required) Error message.

$data

(mixed) (Optional) Error data.

Default value: ''


Top ↑

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;
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.