WP_Error::add_data

Advertisement

Summery Summery

Add data for error code.

Syntax Syntax

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

Description Description

The error code can only contain one error data.

Parameters Parameters

$data

(Required) Error data.

$code

(Optional) Error code.

Default value: ''

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

Advertisement

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Advertisement

Leave a Reply