You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fc047ab
Browse filesBrowse the repository at this point in the historyBrowse files
Abilities API: Avoid _doing_it_wrong() on REST lookups of unknown abilities
The REST controllers resolve an ability or category from a client-controlled name. On a miss, `wp_get_ability()` / `wp_get_ability_category()` reach the registry getter, which fires `_doing_it_wrong()` to flag developer misuse. So a routine 404
emits a spurious notice in Query Monitor, `doing_it_wrong_run` listeners, and tests, including on the unauthenticated run endpoint.
Guard each of the five lookups with the existence helper (`wp_has_ability()` / `wp_has_ability_category()`) first, so a missing name returns a clean 404. Direct misuse of the getters still warns, as intended.
Props dhrupo.
Fixes #65644.
git-svn-id: https://develop.svn.wordpress.org/trunk@62831 602fd350-edb4-49c9-b593-d223f7449a82
0 commit comments