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
Abilities: Address review feedback for ability deprecation
- 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>
__( 'The ability deprecation `replacement` value should be a namespaced ability name, i.e. "my-plugin/my-ability". It can only contain lowercase alphanumeric characters, dashes and the forward slash.' )
Copy file name to clipboardExpand all lines: src/wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -408,17 +408,20 @@ public function get_collection_params(): array {
408
408
'additionalProperties' => true,
409
409
),
410
410
'deprecated' => array(
411
-
'description' => __( 'Limit results by deprecation status or details.' ),
411
+
'description' => __( 'Limit results by deprecation status or details. Use true to return only deprecated abilities, false to return only active abilities, or an object to match specific deprecation details.' ),
412
412
'type' => array( 'boolean', 'object' ),
413
413
'properties' => array(
414
414
'since' => array(
415
-
'type' => 'string',
415
+
'description' => __( 'Version of the ability provider that deprecated the ability.' ),
416
+
'type' => 'string',
416
417
),
417
418
'replacement' => array(
418
-
'type' => 'string',
419
+
'description' => __( 'Namespaced ability to use instead.' ),
"description": "Limit results by deprecation status or details.",
12746
+
"description": "Limit results by deprecation status or details. Use true to return only deprecated abilities, false to return only active abilities, or an object to match specific deprecation details.",
12747
12747
"type": [
12748
12748
"boolean",
12749
12749
"object"
12750
12750
],
12751
12751
"properties": {
12752
12752
"since": {
12753
+
"description": "Version of the ability provider that deprecated the ability.",
12753
12754
"type": "string"
12754
12755
},
12755
12756
"replacement": {
12757
+
"description": "Namespaced ability to use instead.",
0 commit comments