[wp-trac] [WordPress Trac] #64596: Abilities API: Allow nested namespace ability names (2-4 segments)
WordPress Trac
noreply at wordpress.org
Fri Feb 13 22:03:18 UTC 2026
#64596: Abilities API: Allow nested namespace ability names (2-4 segments)
--------------------------------------+-------------------------------
Reporter: jorgefilipecosta | Owner: jorgefilipecosta
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 7.0
Component: AI | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-------------------------------
Comment (by justlevine):
@jorbin thanks for clarifying 🙇
I very much share your general concern and agree about the need for both
forward and backwards compatibility.
That's why we intentionally designed what we merged in around being about
to make this decision in 7.0 in the most graceful possible way, since as
outlined above and elsewhere the additive benefits to URL fragments are
significant and justify the change.
Ability authors who wish to target WordPress 6.9 can give it a non-nested
name. Here's how that'd look as a one-line ternary:
{{{#!php
<?php
wp_register_ability(
// Fallback to subpar namespace if unsupported.
version_compare( '7.0', wp_get_wp_version(), '>=' ) ?
'youcommerce/checkout/coupons/validate' :
'youcommerce/validate_checkout_coupons',
$ability_args
);
}}}
And if an author is targeting 6.9 but forgets to add backcompat? Well,
that's why we made it so `WP_Abilities_Registry::register()` in WP6.9
doesn't throw an error that would break things for the user, and instead
just logs a notice that it's unsupported and skips to the next.
And of course, Abilities registered without nested fragments continue to
work no matter what version of WordPress they were added in. As with REST,
URL fragments, etc there's nothing stopping developers from polluting
their root ability namespace with as many flat-level abilities as they
want.
To me that feels like we've more than passed the bar for bidirectional
compat here. If there are some specific frictions you're seeing please
share and I'm confident we can get them bugfixed in 6.9.x.
Lmk if there are other concerns I or @jorgefilipecosta can assuage.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64596#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list