apply_filters( ‘wp_ability_execute_result’, mixed $result, string $ability_name, mixed $input, WP_Ability $ability )

In this article

Filters the result returned by an ability’s execute callback.

Description

Fires after the registered execute callback runs. Plugins can use this to transform the result — response formatting, stripping internal metadata, content safety filtering, response enrichment, or recovering from a failure by returning a successful value.

The filter receives whatever the registered callback produced, including a WP_Error if execution failed. Filters may pass the WP_Error through unchanged, override it with a recovered result, or convert a successful result into a WP_Error.

Parameters

$resultmixed
The result returned by the registered execute_callback, or a WP_Error if execution failed.
$ability_namestring
The name of the ability.
$inputmixed
The normalized input data.
$abilityWP_Ability
The ability instance.

Source

return apply_filters( 'wp_ability_execute_result', $result, $this->name, $input, $this );

Changelog

VersionDescription
7.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.