apply_filters( 'wp_ability_validate_output', true|WP_Error $is_valid, mixed $output, string $ability_name )
- Since
- 7.1.0
Filters the output validation result for an ability.
Description
Allows developers to add custom validation logic on top of the default JSON Schema validation. If default validation already failed, the filter receives the WP_Error object and can add additional error information or override it. If default validation passed, the filter can add additional validation checks and return a WP_Error if those checks fail.
Compatibility
- WordPress
- since 7.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in 1 of the 5 tracked releases, added in 7.1.0.
Parameters
$is_validtrue|WP_Error- The validation result from default validation.
$outputmixed- The output data being validated.
$ability_namestring- The name of the ability.
Where this hook fires · 1
wp-includes/abilities-api/class-wp-ability.php:748WP_Ability::validate_output()
Source code
* @since 7.1.0 * * @param true|WP_Error $is_valid The validation result from default validation. * @param mixed $output The output data being validated. * @param string $ability_name The name of the ability. */ $validity = apply_filters( 'wp_ability_validate_output', $is_valid, $output, $this->name ); if ( false === $validity ) { return new WP_Error( 'ability_invalid_output', __( 'Invalid output.' ) ); } if ( is_wp_error( $validity ) && $validity->has_errors() ) { return $validity; }Changelog
Introduced in 7.1.0.
Signature, return type and hooks compared across 1 parsed release.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.