acf_validation::get_error │ public │ ACF 5.3.2

This function will return an error for a given input

Method of the class: acf_validation{}

No Hooks.

Returns

(mixed).

Usage

$acf_validation = new acf_validation();
$acf_validation->get_error( $input );
$input(required)
.

Changelog

Since 5.3.2 Introduced.

acf_validation::get_error() code ACF 6.8.8

function get_error( $input ) {

	// bail early if no errors
	if ( empty( $this->errors ) ) {
		return false;
	}

	// loop
	foreach ( $this->errors as $error ) {
		if ( $error['input'] === $input ) {
			return $error;
		}
	}

	// return
	return false;
}