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

(mixed) (Required) Error data.

$code

(string|int) (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

This site uses Akismet to reduce spam. Learn how your comment data is processed.