WP_Error::get_all_error_data() WordPress Method

The WP_Error::get_all_error_data() function returns an array of all error data for a given error code. The array keys are the error codes, and the array values are the error messages.

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

Retrieves all error data for an error code in the order in which the data was added.


Parameters

$code

(string|int)(Optional)Error code.

Default value: ''


Top ↑

Return

(mixed[]) Array of error data, if it exists.


Top ↑

Source

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

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

		$data = array();

		if ( isset( $this->additional_data[ $code ] ) ) {
			$data = $this->additional_data[ $code ];
		}

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

		return $data;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.6.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.