apply_filters( ‘wp_get_abilities_result’, WP_Ability[] $matched, array $args )

In this article

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).
  • category string
    Filter by category slug. Only abilities whose category exactly matches the given slug are included.
  • namespace string
    Filter by ability namespace prefix. Pass the namespace without a trailing slash, e.g. 'woocommerce' matches 'woocommerce/create-order'.
  • meta array
    Filter 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_callback callable
    Optional. A callback invoked per ability after declarative filters. Receives a WP_Ability instance, returns bool.
    Return true to include, false to exclude.
  • result_callback callable
    Optional. 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

VersionDescription
7.1.0Introduced.

User Contributed Notes

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