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: ''

Return

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

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

Changelog

Version Description
5.6.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_error/get_all_error_data