[wp-trac] [WordPress Trac] #64990: Add filtering support to `wp_get_abilities()`

WordPress Trac noreply at wordpress.org
Tue May 26 09:29:59 UTC 2026


#64990: Add filtering support to `wp_get_abilities()`
--------------------------------------------------+---------------------
 Reporter:  gziolo                                |       Owner:  gziolo
     Type:  enhancement                           |      Status:  closed
 Priority:  normal                                |   Milestone:  7.1
Component:  Abilities API                         |     Version:  6.9
 Severity:  normal                                |  Resolution:  fixed
 Keywords:  2nd-opinion has-patch has-unit-tests  |     Focuses:
--------------------------------------------------+---------------------
Changes (by gziolo):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"62420" 62420]:
 {{{
 #!CommitTicketReference repository="" revision="62420"
 Abilities API: Add filtering support to `wp_get_abilities()`

 Extends `wp_get_abilities()` with an optional `$args` array, giving
 callers a shared primitive for filtering registered abilities by
 `category`, `namespace`, or `meta`. Two callback slots —
 `item_include_callback` (per ability) and `result_callback` (on the full
 matched array) — round out the caller-scoped pipeline.

 Two new filters, `wp_get_abilities_item_include` and
 `wp_get_abilities_result`, expose ecosystem-scoped extension points so
 plugins can participate in ability resolution without monkey-patching call
 sites. This replaces the ad-hoc `array_filter` passes that consumers (the
 REST list controller, the MCP adapter, WooCommerce) had each implemented
 independently.

 The REST list controller now delegates to the new primitive instead of
 running its own post-retrieval filtering, and gains a `namespace` query
 parameter alongside the existing `category` filter.

 Called without arguments, `wp_get_abilities()` behaves exactly as before —
 no backward compatibility break.

 Props sheldorofazeroth, gziolo.
 Fixes #64990.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64990#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list