Skip to content

feat: Add support for Ability Deprecation - #13852

Open
justlevine wants to merge 8 commits into
WordPress:trunkfrom
justlevine:deprecated-abilities
Open

justlevine wants to merge 8 commits into
WordPress:trunkfrom
justlevine:deprecated-abilities

Conversation

@justlevine

@justlevine justlevine commented Sep 30, 2026 •

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/64209

Adds a standard way to deprecate an ability without removing it.

Supersedes #10507 (relevant diff)

More specifically:

  • Adds a meta.deprecated property (default null). Set it to an array to mark an ability as deprecated:

    'meta' => array(
        'deprecated' => array(
            'since'       => '2.0.0',                 // Required.
            'replacement' => 'my-plugin/new-ability', // Optional.
            'message'     => 'Additional guidance.',  // Optional.
        ),
    ),
  • Deprecated abilities are hidden from wp_get_abilities() by default, but can be included with the included_deprecated arg, or by explicitly filtering for deprecated metadata.

  • Retrieving or executing a deprecated ability will output a deprecation notice. The deprecated ability only outputs one deprecation notice per lifecycle. Deprecation notices on retrieval (only) are suppressed when include_deprecated or meta.deprecated is explicitly filtered by in wp_get_abilities()

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Opus 5.5
Used for: Updating the tests after changing from #10507


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.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jason_the_adams, gziolo, justlevine.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

JasonTheAdams and others added 8 commits September 30, 2026 15:55
- Support `true` as a shorthand for the `deprecated` meta filter in
  `wp_get_abilities()`, so REST API and PHP callers can request only
  deprecated abilities.
- Validate that the deprecation `replacement` detail is a namespaced
  ability name.
- Handle the `deprecated_ability_run` action while serving REST API
  requests. The notice becomes an `X-WP-DeprecatedAbility` header
  instead of corrupting the JSON response when `WP_DEBUG` is enabled.
- Document the `deprecated` collection parameter details in the REST
  API schema.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- `meta.deprecated` now takes `null|array` instead of `false|array`
- `wp_get_abilities()` hide deprecated abilities by default, a new `allow_deprecated` (or explicit meta filtering) includes them.
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants