apply_filters( ‘wp_pre_execute_ability’, mixed $pre, string $ability_name, mixed $input, WP_Ability $ability )

In this article

Filters whether to short-circuit ability execution.

Description

Returning a value other than the received default bypasses the rest of execute() — input normalization, input validation, permission checks, the registered execute callback, output validation, and the surrounding actions — and the value is returned to the caller as-is. Useful for cached responses, rate limiting, maintenance mode, and test mocking.

To continue with normal execution, return $pre unchanged. This preserves any value (including null, false, or arbitrary objects) as a valid short-circuit result.

Because validation is bypassed, callers that short-circuit are responsible for the integrity of any value they consume from $input.

Parameters

$premixed
The pre-computed result. Return this value unchanged to continue execution.
Default WP_Filter_Sentinel instance unique to this invocation.
$ability_namestring
The name of the ability.
$inputmixed
The raw input passed to execute().
$abilityWP_Ability
The ability instance.

Source

$pre = apply_filters( 'wp_pre_execute_ability', $pre_execute_sentinel, $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.