apply_filters( 'amp_validation_error',  array $error,  array $context )

Description #

Filters the validation error array.

This allows plugins to add amend additional properties which can help with more accurately identifying a validation error beyond the name of the parent node and the element's attributes. The $sources are also omitted because these are only available during an explicit validation request and so they are not suitable for plugins to vary sanitization by. If looking to force a validation error to be ignored, use the 'amp_validation_error_sanitized' filter instead of attempting to return an empty value with this filter (as that is not supported).

Parameters #


(array) Validation error to be printed.


(array) { Context data for validation error sanitization. @type DOMNode $node Node for which the validation error is being reported. May be null. }

Changelog #

Version Description
1.0 Introduced.