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

Add data for error code.


Description Description

The error code can only contain one error data.


Parameters Parameters

$data

(mixed) (Required) Error data.

$code

(string|int) (Optional) Error code.

Default value: ''


Top ↑

Source Source

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

	public function add_data( $data, $code = '' ) {
		if ( empty( $code ) ) {
			$code = $this->get_error_code();
		}

		$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.