Filters whether an individual ability should be included in the result set.
Description
Fires after the declarative filters and the caller-scoped item_include_callback.
Plugins can use this to enforce universal inclusion rules regardless of what the caller passed in $args.
Parameters
$includebool- Whether to include the ability. Default true (after declarative filters pass).
$abilityWP_Ability- The ability instance being evaluated.
$argsarray- The full $args array passed to wp_get_abilities() .
More Arguments from wp_get_abilities( … $args )
Arguments to filter the returned abilities. Default empty array (returns all).
categorystringFilter by category slug. Only abilities whose category exactly matches the given slug are included.namespacestringFilter by ability namespace prefix. Pass the namespace without a trailing slash, e.g.'woocommerce'matches'woocommerce/create-order'.metaarrayFilter by meta key/value pairs. All conditions must match (AND logic). Supports nested arrays for structured meta, e.g.array( 'mcp' => array( 'public' => true ) ).item_include_callbackcallableOptional. A callback invoked per ability after declarative filters. Receives a WP_Ability instance, returns bool.
Return true to include, false to exclude.result_callbackcallableOptional. A callback invoked once on the full matched array. Receives WP_Ability[], must return WP_Ability[].
Use for sorting, slicing, or reshaping the result.
Source
$include = (bool) apply_filters( 'wp_get_abilities_item_include', $include, $ability, $args );
Changelog
| Version | Description |
|---|---|
| 7.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.