Repository navigation
Conversation
Updates the Abilities API docblocks so they match how the code works: - Explain how `required_capabilities` and `permission_callback` work together. Required capabilities apply to every execution. The permission callback checks what depends on the input. - Fix the examples. Remove `required` from schemas, register categories before use, and use input in the permission callback. - Describe the execution lifecycle and the order of its hooks. - Clarify what `wp_get_abilities()` returns, and how its filters and the `meta` matching work. - Document the naming rules for abilities and category slugs more precisely. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
There was a problem hiding this comment.
🟢 Approval recommended
The documentation-only changes match the reviewed implementation, with no unresolved issues.
No open issues 🎉
What changed in this PR
Updates Abilities API inline documentation to reflect existing behavior without changing runtime code.
Changes:
- Clarifies capability requirements and input-dependent permission checks.
- Documents schemas, callbacks, execution hooks, and discovery filtering.
- Corrects examples and naming constraints.
| File | Description |
|---|---|
src/wp-includes/abilities-api/class-wp-ability.php |
Clarifies required capabilities in class docblocks. |
src/wp-includes/abilities-api/class-wp-abilities-registry.php |
Aligns registration documentation with permission behavior. |
src/wp-includes/abilities-api.php |
Expands API guidance and corrects examples and documented contracts. |
Review effort: Balanced
Clarify required capabilities and input-dependent permission checks, schema handling, callbacks, and execution hooks. Correct registration examples and naming constraints, and document discovery filtering and preservation of ability keys. Developed in #14550. Props gziolo, jorgefilipecosta. See #66325, #65569. git-svn-id: https://develop.svn.wordpress.org/trunk@64685 602fd350-edb4-49c9-b593-d223f7449a82
Clarify required capabilities and input-dependent permission checks, schema handling, callbacks, and execution hooks. Correct registration examples and naming constraints, and document discovery filtering and preservation of ability keys. Developed in WordPress/wordpress-develop#14550. Props gziolo, jorgefilipecosta. See #66325, #65569. Built from https://develop.svn.wordpress.org/trunk@64685 git-svn-id: http://core.svn.wordpress.org/trunk@63835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
Committed with https://core.trac.wordpress.org/changeset/64685. |
This PR updates the Abilities API docblocks so they match how the code works. It changes documentation only. The code is not changed.
What changed
required_capabilitiesandpermission_callbackwork together. List the capabilities needed for every execution inrequired_capabilities. Check anything that depends on the input inpermission_callback. The examples now follow this rule.requiredfrom the input and output schemas, because it has no effect there. Adds a note that a custom category must be registered before an ability can use it. Thewp_get_abilities()sorting example now keeps the array keys.defaultvalue is used, and what arguments the callbacks receive. Notes that exceptions thrown by callbacks are converted toWP_Error.WP_Ability::execute()runs, in order.wp_get_abilities(). Clarifies which abilities reach thewp_get_abilities_item_includefilter, howmetamatching works, and whathas_required_capabilitiesdoes and does not check.Trac ticket: https://core.trac.wordpress.org/ticket/66325, https://core.trac.wordpress.org/ticket/65569
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code, OpenAI Codex
Model(s): Claude Opus 5.5, GPT-6
Used for: Checking docblocks against the implementation, reviewing the PR, refining documentation, and running validation checks. I reviewed all changes.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
🤖 Generated with Claude Code