WP_Error::get_error_data() WordPress Method

The WP_Error::get_error_data() method is used to retrieve the data associated with an error. This can be useful for debugging purposes.

WP_Error::get_error_data( string|int $code = '' ) #

Retrieves the most recently added error data for an error code.


Parameters

$code

(string|int)(Optional) Error code.

Default value: ''


Top ↑

Return

(mixed) Error data, if it exists.


Top ↑

Source

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

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

		if ( isset( $this->error_data[ $code ] ) ) {
			return $this->error_data[ $code ];
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.