Filters the full list of matched abilities after all per-item filtering is complete.
Description
Fires after the caller-scoped result_callback. Plugins can use this to sort, paginate, or reshape the final result set universally.
Parameters
$matchedWP_Ability[]- The matched abilities after all filtering.
$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
return (array) apply_filters( 'wp_get_abilities_result', $matched, $args );
Changelog
| Version | Description |
|---|---|
| 7.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.