wppaste
WordPress

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

Since
7.1.0
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.

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

$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.

Where this hook fires · 1

  • wp-includes/abilities-api/class-wp-ability.php:701WP_Ability::do_execute()

Source code

		 * @param mixed      $result       The result returned by the registered `execute_callback`,		 *                                 or a `WP_Error` if execution failed.		 * @param string     $ability_name The name of the ability.		 * @param mixed      $input        The normalized input data.		 * @param WP_Ability $ability      The ability instance.		 */		return apply_filters( 'wp_ability_execute_result', $result, $this->name, $input, $this );	} 	/**	 * Validates output data against the output schema.	 *	 * @since 6.9.0

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.