[wp-trac] [WordPress Trac] #64596: Abilities API: Allow nested namespace ability names (2-4 segments)
WordPress Trac
noreply at wordpress.org
Wed Feb 4 15:33:30 UTC 2026
#64596: Abilities API: Allow nested namespace ability names (2-4 segments)
------------------------------+------------------------------
Reporter: jorgefilipecosta | Owner: jorgefilipecosta
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 7.0
Component: AI | Version: trunk
Severity: normal | Keywords:
Focuses: |
------------------------------+------------------------------
The current ability naming convention only allows a single namespace
separator (`my-plugin/my-ability`). This is too restrictive for organizing
abilities into logical resource groups. With this change, plugins can
register abilities like `core/posts/find`, `core/posts/create`, or `my-
plugin/resource/sub/action`.
We should change the validation regex in
`WP_Abilities_Registry::register()` from:
`/^[a-z0-9-]+\/[a-z0-9-]+$/`
to:
`/^[a-z0-9-]+(?:\/[a-z0-9-]+){1,3}$/`
This allows the first segment plus 1-3 additional slash-delimited segments
(2-4 total). The REST API route patterns in both controllers already
accepted multiple slashes, so no route changes were needed.
This ticket comes from a suggestion from @justlevine at
https://github.com/WordPress/wordpress-
develop/pull/10665#issuecomment-3769756790 :
> Necessary caveats out of the way, I'd recommend we solve the naming
issue holistically with nested namespaces, a pattern that because it's
good for human cognitive overload, which just so happens to mean that it
aligns with inference best practices too. (related:
[core.trac.wordpress.org/ticket/64345#comment:5](https://core.trac.wordpress.org/ticket/64345#comment:5)).
> Which would turn these into:
> core/posts/find or get (As noted inline, I think getting a single post
is superfluous, and both use cases can be more intuitively handled with an
improved input shape, e.g. by ).
core/posts/create
core/posts/update
We plan to use this new type of naming for post abilities.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64596>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list