From df448834d83a63d82a2f4b482846735711f649d1 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 13 Nov 2026 21:08:01 +0000 Subject: [PATCH 01/13] Add CORE-SHAPE.md: the target shape of the core abilities Adds the core abilities schema quick reference as CORE-SHAPE.md: the name, category, annotations, REST method, examples, and input and output schemas of all 18 core/ abilities. It is the source of truth for their shape; where the package code differs, the code is updated to match it. Links it from the README's current abilities section and from the proposal step in NAME-LIFECYCLE.md. --- CORE-SHAPE.md | 2229 +++++++++++++++++++++++++++++++++++++++++++++ NAME-LIFECYCLE.md | 3 +- README.md | 4 + 3 files changed, 2235 insertions(+), 1 deletion(-) create mode 100644 CORE-SHAPE.md diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md new file mode 100644 index 0000000..6c1fb7a --- /dev/null +++ b/CORE-SHAPE.md @@ -0,0 +1,2229 @@ +# Core Abilities Schema Quick Reference + +This document is the source of truth for the shape of the core abilities: +their names, input and output schemas, and behavior. Where the package code +differs, the code is updated to match it. + +| Ability | Status | Category | readonly / destructive / idempotent | REST transport method | +|---|---|---|---|---| +| `core/content-query` | Landed, 213ecca2e9 | content | true / false / true | GET | +| `core/content-create` | Proposed | content | false / false / false | POST | +| `core/content-update` | Proposed | content | false / false / true | POST | +| `core/content-delete` | Proposed | content | false / true / true | DELETE | +| `core/settings-get` | Landed, b6512b1e8c | site | true / false / true | GET | +| `core/settings-update` | Proposed | site | false / false / true | POST | +| `core/users-query` | Landed, 39981fd0fe | user | true / false / true | GET | +| `core/user-create` | Proposed | user | false / false / false | POST | +| `core/user-update` | Proposed | user | false / false / true | POST | +| `core/user-delete` | Proposed | user | false / true / true | DELETE | +| `core/media-query` | Proposed | content | true / false / true | GET | +| `core/media-upload` | Proposed | content | false / false / false | POST | +| `core/media-update` | Proposed | content | false / false / true | POST | +| `core/media-delete` | Proposed | content | false / true / true | DELETE | +| `core/terms-query` | Proposed | content | true / false / true | GET | +| `core/term-create` | Proposed | content | false / false / false | POST | +| `core/term-update` | Proposed | content | false / false / true | POST | +| `core/term-delete` | Proposed | content | false / true / true | DELETE | + +Errors are `WP_Error` objects. Each "Example N error" block shows one as the REST response body (`code`, `message`, `data`); errors are not validated against the output schema. + +## Content abilities + +### `core/content-query` + +Example 1 input, the drafts of the `post` type with chosen fields: + +```json +{ "where": { "type": "post", "status": [ "draft" ] }, "fields": [ "title", "date", "author" ] } +``` + +Example 1 output: + +```json +{ + "items": [ + { + "id": 123, + "date": { "site": "2026-10-21T09:30:00+01:00", "gmt": "2026-10-21T08:30:00+00:00" }, + "title": { "raw": "Launch notes", "rendered": "Launch notes" }, + "author": { "id": 42, "name": "Maya Carter", "slug": "mcarter" } + } + ], + "pagination": { "total": 1, "total_pages": 1 } +} +``` + +Example 2 input, the child pages of page 7, two per page, with the default fields: + +```json +{ "where": { "type": "page", "parent": 7 }, "pagination": { "per_page": 2 } } +``` + +Example 2 output: + +```json +{ + "items": [ + { + "id": 126, + "type": "page", + "status": "publish", + "date": { "site": "2026-10-21T09:40:00+01:00", "gmt": "2026-10-21T08:40:00+00:00" }, + "slug": "pricing", + "title": { "rendered": "Pricing" } + }, + { + "id": 118, + "type": "page", + "status": "publish", + "date": { "site": "2026-10-02T11:00:00+01:00", "gmt": "2026-10-02T10:00:00+00:00" }, + "slug": "features", + "title": { "rendered": "Features" } + } + ], + "pagination": { "total": 3, "total_pages": 2 } +} +``` + +Example 3 input, `parent` on a flat type: + +```json +{ "where": { "type": "post", "parent": 7 } } +``` + +Example 3 error: + +```json +{ + "code": "content_invalid_filter", + "message": "The parent filter is only supported for hierarchical post types.", + "data": { "status": 400, "params": { "where[parent]": "The parent filter is only supported for hierarchical post types." } } +} +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where" ], + "properties": { + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "type" ], + "properties": { + "type": { "type": "string", "enum": [ "post", "page" ] }, + "ids": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "integer", "minimum": 1 } }, + "slugs": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, + "status": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "publish", "future", "draft", "pending", "private" ] } }, + "author": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "id": { "type": "integer", "minimum": 1 }, + "slug": { "type": "string", "minLength": 1 } + } + }, + "parent": { "type": "integer", "minimum": 0 } + } + }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "id", "type", "status", "date", "date.site", "date.gmt", "modified", "modified.site", + "modified.gmt", "slug", "link", "title", "title.raw", "title.rendered", "excerpt", + "excerpt.raw", "excerpt.rendered", "excerpt.protected", "content", "content.raw", + "content.rendered", "content.protected", "author", "author.id", "author.name", + "author.slug", "parent" + ] + } + }, + "pagination": { + "type": "object", + "additionalProperties": false, + "properties": { "page": { "type": "integer", "minimum": 1 }, "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } } + } + } +} +``` + +Default `fields`: `id, type, status, date, slug, title.rendered`. + +Trashed posts cannot be read today: `where.status` has no `trash` value. It gets one when `core/content-delete` is added. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "items", "pagination" ], + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "type": { "type": "string" }, + "status": { "type": "string" }, + "date": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "modified": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "excerpt": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, + "content": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, + "author": { + "type": "object", + "additionalProperties": false, + "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + }, + "parent": { "type": "integer" } + } + } + }, + "pagination": { + "type": "object", + "additionalProperties": false, + "required": [ "total", "total_pages" ], + "properties": { "total": { "type": "integer" }, "total_pages": { "type": "integer" } } + } + } +} +``` + +### `core/content-create` + +Example 1 input, a draft with the default fields: + +```json +{ "data": { "type": "post", "title": "Launch notes" } } +``` + +Example 1 output: + +```json +{ + "id": 123, + "type": "post", + "status": "draft", + "date": { "site": "2026-10-21T09:30:00+01:00", "gmt": "2026-10-21T08:30:00+00:00" }, + "slug": "", + "title": { "rendered": "Launch notes" } +} +``` + +Example 2 input, a published child page with chosen fields: + +```json +{ + "data": { + "type": "page", + "title": "Pricing", + "content": "\n

Plans start at 9 euro per month.

\n", + "status": "publish", + "parent": 7, + "slug": "pricing" + }, + "fields": [ "status", "link", "title.rendered", "content.rendered", "parent" ] +} +``` + +Example 2 output: + +```json +{ + "id": 126, + "status": "publish", + "link": "https://example.test/products/pricing/", + "title": { "rendered": "Pricing" }, + "content": { "rendered": "

Plans start at 9 euro per month.

\n" }, + "parent": 7 +} +``` + +Example 3 input, an attribute the post type does not support: + +```json +{ "data": { "type": "post", "title": "Launch notes", "parent": 7 } } +``` + +Example 3 error: + +```json +{ + "code": "content_invalid_attribute", + "message": "Invalid attribute: parent.", + "data": { "status": 400, "params": { "data[parent]": "The post type is not hierarchical." } } +} +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "data" ], + "properties": { + "data": { + "type": "object", + "additionalProperties": false, + "required": [ "type" ], + "properties": { + "type": { "type": "string", "enum": [ "post", "page" ] }, + "title": { "type": "string" }, + "content": { "type": "string" }, + "excerpt": { "type": "string" }, + "status": { "type": "string", "enum": [ "publish", "future", "draft", "pending", "private" ] }, + "slug": { "type": "string", "minLength": 1 }, + "date": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { "site": { "type": "string", "format": "date-time" }, "gmt": { "type": "string", "format": "date-time" } } + }, + "author": { "type": "integer", "minimum": 1 }, + "parent": { "type": "integer", "minimum": 0 } + } + }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "id", "type", "status", "date", "date.site", "date.gmt", "modified", "modified.site", + "modified.gmt", "slug", "link", "title", "title.raw", "title.rendered", "excerpt", + "excerpt.raw", "excerpt.rendered", "excerpt.protected", "content", "content.raw", + "content.rendered", "content.protected", "author", "author.id", "author.name", + "author.slug", "parent" + ] + } + } + } +} +``` + +Default `fields`: `id, type, status, date, slug, title.rendered`. + +`data.date` takes `site`, `gmt` or both; `site` wins when both are sent. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "type": { "type": "string" }, + "status": { "type": "string" }, + "date": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "modified": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "excerpt": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, + "content": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, + "author": { + "type": "object", + "additionalProperties": false, + "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + }, + "parent": { "type": "integer" } + } +} +``` + +### `core/content-update` + +Example 1 input, a new title and excerpt: + +```json +{ + "where": { "type": "post", "id": 123 }, + "data": { "title": "Launch notes, updated", "excerpt": "What shipped and what is next." }, + "fields": [ "modified", "title", "excerpt" ] +} +``` + +Example 1 output: + +```json +{ + "id": 123, + "modified": { "site": "2026-10-21T10:05:00+01:00", "gmt": "2026-10-21T09:05:00+00:00" }, + "title": { "raw": "Launch notes, updated", "rendered": "Launch notes, updated" }, + "excerpt": { "raw": "What shipped and what is next.", "rendered": "

What shipped and what is next.

\n", "protected": false } +} +``` + +Example 2 input, publishing the draft: + +```json +{ "where": { "type": "post", "id": 123 }, "data": { "status": "publish" }, "fields": [ "status", "slug", "link" ] } +``` + +Example 2 output: + +```json +{ "id": 123, "status": "publish", "slug": "launch-notes-updated", "link": "https://example.test/launch-notes-updated/" } +``` + +Example 3 input, a post the user cannot edit: + +```json +{ "where": { "type": "post", "id": 123 }, "data": { "title": "Launch notes" } } +``` + +Example 3 error: + +```json +{ "code": "content_cannot_edit", "message": "Sorry, you are not allowed to edit this post.", "data": { "status": 403 } } +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where", "data" ], + "properties": { + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "type", "id" ], + "properties": { "type": { "type": "string", "enum": [ "post", "page" ] }, "id": { "type": "integer", "minimum": 1 } } + }, + "data": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "title": { "type": "string" }, + "content": { "type": "string" }, + "excerpt": { "type": "string" }, + "status": { "type": "string", "enum": [ "publish", "future", "draft", "pending", "private" ] }, + "slug": { "type": "string", "minLength": 1 }, + "date": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { "site": { "type": "string", "format": "date-time" }, "gmt": { "type": "string", "format": "date-time" } } + }, + "author": { "type": "integer", "minimum": 1 }, + "parent": { "type": "integer", "minimum": 0 } + } + }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "id", "type", "status", "date", "date.site", "date.gmt", "modified", "modified.site", + "modified.gmt", "slug", "link", "title", "title.raw", "title.rendered", "excerpt", + "excerpt.raw", "excerpt.rendered", "excerpt.protected", "content", "content.raw", + "content.rendered", "content.protected", "author", "author.id", "author.name", + "author.slug", "parent" + ] + } + } + } +} +``` + +Default `fields`: `id, type, status, date, slug, title.rendered`. + +`data.date` takes `site`, `gmt` or both; `site` wins when both are sent. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "type": { "type": "string" }, + "status": { "type": "string" }, + "date": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "modified": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "excerpt": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, + "content": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, + "author": { + "type": "object", + "additionalProperties": false, + "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + }, + "parent": { "type": "integer" } + } +} +``` + +### `core/content-delete` + +Example 1 input, trashing a post: + +```json +{ "where": { "type": "post", "id": 123 } } +``` + +Over REST: + +```http +DELETE /wp-json/wp-abilities/v1/abilities/core/content-delete/run?input[where][type]=post&input[where][id]=123 +``` + +Example 1 output: + +```json +{ "outcome": "trashed" } +``` + +Example 2 input, deleting a page permanently: + +```json +{ "where": { "type": "page", "id": 126 }, "permanent": true } +``` + +Example 2 output: + +```json +{ "outcome": "deleted" } +``` + +Example 3 input, trashing the post of example 1 again: + +```json +{ "where": { "type": "post", "id": 123 } } +``` + +Example 3 error: + +```json +{ "code": "content_already_trashed", "message": "The post has already been trashed.", "data": { "status": 410 } } +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where" ], + "properties": { + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "type", "id" ], + "properties": { "type": { "type": "string", "enum": [ "post", "page" ] }, "id": { "type": "integer", "minimum": 1 } } + }, + "permanent": { "type": "boolean" } + } +} +``` + +When this ability is added, `core/content-query` takes `trash` in `where.status`, so trashed posts can be read. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "outcome" ], + "properties": { "outcome": { "type": "string" } } +} +``` + +## Settings abilities + +### `core/settings-get` + +Example 1 input, one group: + +```json +{ "group": "reading" } +``` + +Example 1 output: + +```json +{ "posts_per_page": 10, "show_on_front": "posts", "page_on_front": 0, "page_for_posts": 0, "page_for_privacy_policy": 3 } +``` + +Example 2 input, two named settings: + +```json +{ "fields": [ "title", "timezone" ] } +``` + +Example 2 output: + +```json +{ "title": "Acme Robotics", "timezone": "Europe/Lisbon" } +``` + +Input schema: + +```json +{ + "type": "object", + "default": {}, + "additionalProperties": false, + "properties": { + "group": { "type": "string", "enum": [ "general", "writing", "reading", "discussion" ] }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ "title", "description", "url", "email", "timezone", "date_format", "time_format", "start_of_week", "language", "use_smilies", "default_category", "default_post_format", "posts_per_page", "show_on_front", "page_on_front", "page_for_posts", "page_for_privacy_policy", "default_ping_status", "default_comment_status" ] + } + } + } +} +``` + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "properties": { + "title": { "type": "string" }, + "description": { "type": "string" }, + "url": { "type": "string", "format": "uri" }, + "email": { "type": "string", "format": "email" }, + "timezone": { "type": "string" }, + "date_format": { "type": "string" }, + "time_format": { "type": "string" }, + "start_of_week": { "type": "integer" }, + "language": { "type": "string" }, + "use_smilies": { "type": "boolean" }, + "default_category": { "type": "integer" }, + "default_post_format": { "type": "string" }, + "posts_per_page": { "type": "integer" }, + "show_on_front": { "type": "string" }, + "page_on_front": { "type": "integer" }, + "page_for_posts": { "type": "integer" }, + "page_for_privacy_policy": { "type": "integer" }, + "default_ping_status": { "type": "string", "enum": [ "open", "closed" ] }, + "default_comment_status": { "type": "string", "enum": [ "open", "closed" ] } + } +} +``` + +### `core/settings-update` + +Example 1 input, a title, a reading option and a deleted option: + +```json +{ "data": { "title": "Acme Robotics", "posts_per_page": 12, "use_smilies": null } } +``` + +Over REST: + +```http +POST /wp-json/wp-abilities/v1/abilities/core/settings-update/run +{ "input": { "data": { "title": "Acme Robotics", "posts_per_page": 12, "use_smilies": null } } } +``` + +Example 1 output: + +```json +{ "title": "Acme Robotics", "posts_per_page": 12, "use_smilies": true } +``` + +Example 2 input, closing discussion on new posts: + +```json +{ "data": { "default_comment_status": "closed", "default_ping_status": "closed" } } +``` + +Example 2 output: + +```json +{ "default_comment_status": "closed", "default_ping_status": "closed" } +``` + +Example 3 input, deleting a setting whose stored value no longer matches its schema: + +```json +{ "data": { "posts_per_page": null } } +``` + +Example 3 error: + +```json +{ + "code": "settings_invalid_stored_value", + "message": "The posts_per_page property has an invalid stored value, and cannot be updated to null.", + "data": { "status": 500 } +} +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "data" ], + "properties": { + "data": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "title": { "type": [ "string", "null" ] }, + "description": { "type": [ "string", "null" ] }, + "url": { "type": [ "string", "null" ], "format": "uri" }, + "email": { "type": [ "string", "null" ], "format": "email" }, + "timezone": { "type": [ "string", "null" ] }, + "date_format": { "type": [ "string", "null" ] }, + "time_format": { "type": [ "string", "null" ] }, + "start_of_week": { "type": [ "integer", "null" ] }, + "language": { "type": [ "string", "null" ] }, + "use_smilies": { "type": [ "boolean", "null" ] }, + "default_category": { "type": [ "integer", "null" ] }, + "default_post_format": { "type": [ "string", "null" ] }, + "posts_per_page": { "type": [ "integer", "null" ] }, + "show_on_front": { "type": [ "string", "null" ] }, + "page_on_front": { "type": [ "integer", "null" ] }, + "page_for_posts": { "type": [ "integer", "null" ] }, + "page_for_privacy_policy": { "type": [ "integer", "null" ] }, + "default_ping_status": { "type": [ "string", "null" ], "enum": [ "open", "closed", null ] }, + "default_comment_status": { "type": [ "string", "null" ], "enum": [ "open", "closed", null ] } + } + } + } +} +``` + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "properties": { + "title": { "type": "string" }, + "description": { "type": "string" }, + "url": { "type": "string", "format": "uri" }, + "email": { "type": "string", "format": "email" }, + "timezone": { "type": "string" }, + "date_format": { "type": "string" }, + "time_format": { "type": "string" }, + "start_of_week": { "type": "integer" }, + "language": { "type": "string" }, + "use_smilies": { "type": "boolean" }, + "default_category": { "type": "integer" }, + "default_post_format": { "type": "string" }, + "posts_per_page": { "type": "integer" }, + "show_on_front": { "type": "string" }, + "page_on_front": { "type": "integer" }, + "page_for_posts": { "type": "integer" }, + "page_for_privacy_policy": { "type": "integer" }, + "default_ping_status": { "type": "string", "enum": [ "open", "closed" ] }, + "default_comment_status": { "type": "string", "enum": [ "open", "closed" ] } + } +} +``` + +## User abilities + +### `core/users-query` + +Example 1 input, the editors with chosen fields: + +```json +{ "where": { "roles": [ "editor" ] }, "fields": [ "name", "slug", "roles" ] } +``` + +Example 1 output: + +```json +{ + "items": [ { "id": 42, "name": "Maya Carter", "slug": "mcarter", "roles": [ "editor" ] } ], + "pagination": { "total": 1, "total_pages": 1 } +} +``` + +Example 2 input, the public authors with the default fields: + +```json +{ "where": { "has_published_posts": true } } +``` + +Example 2 output: + +```json +{ + "items": [ + { + "id": 42, + "name": "Maya Carter", + "link": "https://example.test/author/mcarter/", + "slug": "mcarter", + "avatar_urls": { + "24": "https://secure.gravatar.com/avatar/9f3a…?s=24&d=mm&r=g", + "48": "https://secure.gravatar.com/avatar/9f3a…?s=48&d=mm&r=g", + "96": "https://secure.gravatar.com/avatar/9f3a…?s=96&d=mm&r=g" + } + } + ], + "pagination": { "total": 1, "total_pages": 1 } +} +``` + +Example 3 input, a page past the last one: + +```json +{ "where": { "roles": [ "editor" ] }, "pagination": { "page": 2 } } +``` + +Example 3 error: + +```json +{ "code": "users_invalid_page_number", "message": "The page number requested is larger than the number of pages available.", "data": { "status": 404 } } +``` + +Input schema: + +```json +{ + "type": "object", + "default": {}, + "additionalProperties": false, + "properties": { + "where": { + "type": "object", + "additionalProperties": false, + "properties": { + "ids": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "integer", "minimum": 1 } }, + "slugs": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, + "usernames": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, + "roles": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "administrator", "editor", "author", "contributor", "subscriber" ] } }, + "has_published_posts": { + "anyOf": [ + { "type": "boolean", "enum": [ true ] }, + { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "post", "page", "attachment" ] } } + ] + } + } + }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ "id", "name", "description", "url", "link", "slug", "avatar_urls", "username", "email", "first_name", "last_name", "nickname", "locale", "registered", "registered.site", "registered.gmt", "roles" ] + } + }, + "pagination": { + "type": "object", + "additionalProperties": false, + "properties": { "page": { "type": "integer", "minimum": 1 }, "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } } + } + } +} +``` + +Default `fields`: `id, name, link, slug, avatar_urls`. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "items", "pagination" ], + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "name": { "type": "string" }, + "description": { "type": "string" }, + "url": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "slug": { "type": "string" }, + "avatar_urls": { "type": "object", "additionalProperties": { "type": [ "string", "null" ], "format": "uri" } }, + "username": { "type": "string" }, + "email": { "type": [ "string", "null" ], "format": "email" }, + "first_name": { "type": "string" }, + "last_name": { "type": "string" }, + "nickname": { "type": "string" }, + "locale": { "type": "string" }, + "registered": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "roles": { "type": "array", "items": { "type": "string" } } + } + } + }, + "pagination": { + "type": "object", + "additionalProperties": false, + "required": [ "total", "total_pages" ], + "properties": { "total": { "type": "integer" }, "total_pages": { "type": "integer" } } + } + } +} +``` + +### `core/user-create` + +Example 1 input, an editor with chosen fields: + +```json +{ + "data": { "username": "mcarter", "email": "m.carter@example.test", "name": "Maya Carter", "first_name": "Maya", "last_name": "Carter", "roles": [ "editor" ] }, + "fields": [ "name", "slug", "username", "email", "registered", "roles" ] +} +``` + +Example 1 output: + +```json +{ + "id": 42, + "name": "Maya Carter", + "slug": "mcarter", + "username": "mcarter", + "email": "m.carter@example.test", + "registered": { "site": "2026-10-21T09:30:00+01:00", "gmt": "2026-10-21T08:30:00+00:00" }, + "roles": [ "editor" ] +} +``` + +Example 2 input, the minimum input with the default fields: + +```json +{ "data": { "username": "jdoe", "email": "j.doe@example.test" } } +``` + +Example 2 output: + +```json +{ + "id": 43, + "name": "jdoe", + "link": "https://example.test/author/jdoe/", + "slug": "jdoe", + "avatar_urls": { + "24": "https://secure.gravatar.com/avatar/5a1d…?s=24&d=mm&r=g", + "48": "https://secure.gravatar.com/avatar/5a1d…?s=48&d=mm&r=g", + "96": "https://secure.gravatar.com/avatar/5a1d…?s=96&d=mm&r=g" + } +} +``` + +Example 3 input, a username that is taken: + +```json +{ "data": { "username": "mcarter", "email": "maya.c@example.test" } } +``` + +Example 3 error: + +```json +{ + "code": "user_exists", + "message": "Sorry, that username already exists!", + "data": { "status": 400, "params": { "data[username]": "Sorry, that username already exists!" } } +} +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "data" ], + "properties": { + "data": { + "type": "object", + "additionalProperties": false, + "required": [ "username", "email" ], + "properties": { + "username": { "type": "string", "minLength": 1 }, + "email": { "type": "string", "format": "email" }, + "name": { "type": "string", "minLength": 1 }, + "first_name": { "type": "string" }, + "last_name": { "type": "string" }, + "nickname": { "type": "string", "minLength": 1 }, + "slug": { "type": "string", "minLength": 1 }, + "description": { "type": "string" }, + "url": { "type": "string" }, + "locale": { "type": "string", "enum": [ "", "en_US", "pt_PT" ] }, + "roles": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "administrator", "editor", "author", "contributor", "subscriber" ] } } + } + }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ "id", "name", "description", "url", "link", "slug", "avatar_urls", "username", "email", "first_name", "last_name", "nickname", "locale", "registered", "registered.site", "registered.gmt", "roles" ] + } + } + } +} +``` + +Default `fields`: `id, name, link, slug, avatar_urls`. + +The input takes no `password`: WordPress generates one and emails the new user a link to set their own, the same email the Add User screen sends when "Send the new user an email about their account" is checked. The site admin gets the usual new user notice. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "name": { "type": "string" }, + "description": { "type": "string" }, + "url": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "slug": { "type": "string" }, + "avatar_urls": { "type": "object", "additionalProperties": { "type": [ "string", "null" ], "format": "uri" } }, + "username": { "type": "string" }, + "email": { "type": [ "string", "null" ], "format": "email" }, + "first_name": { "type": "string" }, + "last_name": { "type": "string" }, + "nickname": { "type": "string" }, + "locale": { "type": "string" }, + "registered": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "roles": { "type": "array", "items": { "type": "string" } } + } +} +``` + +### `core/user-update` + +Example 1 input, a role change and a biography: + +```json +{ + "where": { "id": 42 }, + "data": { "roles": [ "author" ], "description": "Writes about hardware." }, + "fields": [ "name", "description", "roles" ] +} +``` + +Example 1 output: + +```json +{ "id": 42, "name": "Maya Carter", "description": "Writes about hardware.", "roles": [ "author" ] } +``` + +Example 2 input, a user changing their own email address: + +```json +{ "where": { "id": 42 }, "data": { "email": "maya@example.test" }, "fields": [ "email" ] } +``` + +Example 2 output: + +```json +{ "id": 42, "email": "maya@example.test" } +``` + +Example 3 input, an editor trying to change roles, which needs `promote_user`: + +```json +{ "where": { "id": 43 }, "data": { "roles": [ "author" ] } } +``` + +Example 3 error: + +```json +{ "code": "user_cannot_edit_roles", "message": "Sorry, you are not allowed to edit the roles of this user.", "data": { "status": 403 } } +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where", "data" ], + "properties": { + "where": { "type": "object", "additionalProperties": false, "required": [ "id" ], "properties": { "id": { "type": "integer", "minimum": 1 } } }, + "data": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "email": { "type": "string", "format": "email" }, + "name": { "type": "string", "minLength": 1 }, + "first_name": { "type": "string" }, + "last_name": { "type": "string" }, + "nickname": { "type": "string", "minLength": 1 }, + "slug": { "type": "string", "minLength": 1 }, + "description": { "type": "string" }, + "url": { "type": "string" }, + "locale": { "type": "string", "enum": [ "", "en_US", "pt_PT" ] }, + "roles": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "administrator", "editor", "author", "contributor", "subscriber" ] } } + } + }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ "id", "name", "description", "url", "link", "slug", "avatar_urls", "username", "email", "first_name", "last_name", "nickname", "locale", "registered", "registered.site", "registered.gmt", "roles" ] + } + } + } +} +``` + +Default `fields`: `id, name, link, slug, avatar_urls`. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "name": { "type": "string" }, + "description": { "type": "string" }, + "url": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "slug": { "type": "string" }, + "avatar_urls": { "type": "object", "additionalProperties": { "type": [ "string", "null" ], "format": "uri" } }, + "username": { "type": "string" }, + "email": { "type": [ "string", "null" ], "format": "email" }, + "first_name": { "type": "string" }, + "last_name": { "type": "string" }, + "nickname": { "type": "string" }, + "locale": { "type": "string" }, + "registered": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "roles": { "type": "array", "items": { "type": "string" } } + } +} +``` + +### `core/user-delete` + +Example 1 input, deleting a user and handing their posts to user 7: + +```json +{ "where": { "id": 42 }, "reassign": 7 } +``` + +Over REST: + +```http +DELETE /wp-json/wp-abilities/v1/abilities/core/user-delete/run?input[where][id]=42&input[reassign]=7 +``` + +Example 1 output: + +```json +{ "outcome": "deleted" } +``` + +Example 2 output, the same call on a multisite network: + +```json +{ "outcome": "removed" } +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where", "reassign" ], + "properties": { + "where": { "type": "object", "additionalProperties": false, "required": [ "id" ], "properties": { "id": { "type": "integer", "minimum": 1 } } }, + "reassign": { "type": [ "integer", "boolean" ], "minimum": 1 } + } +} +``` + +`reassign` is required: the ID of the user who takes over the deleted user's content, or `false` to reassign nothing. With `false` the user's content is removed as well, as "Delete all content" does on the Users screen (posts and pages go to the trash); send it too when the user has no content. `true` is rejected. + +On multisite the user is removed from the current site instead, as "Remove" does on the site's Users screen: `outcome` is `removed` and the account stays in the network. There, `reassign: false` leaves the user's content in place; a user ID still reassigns it. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "outcome" ], + "properties": { "outcome": { "type": "string" } } +} +``` + +## Media abilities + +### `core/media-query` + +Example 1 input, the images attached to post 123 with chosen fields: + +```json +{ + "where": { "media_type": [ "image" ], "post": 123 }, + "fields": [ "title.rendered", "alt_text", "source_url", "media_details.width", "media_details.height" ] +} +``` + +Example 1 output: + +```json +{ + "items": [ + { + "id": 310, + "title": { "rendered": "Team photo" }, + "alt_text": "The team on the office roof", + "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo.jpg", + "media_details": { "width": 2048, "height": 1365 } + } + ], + "pagination": { "total": 1, "total_pages": 1 } +} +``` + +Example 2 input, two attachments by ID with the default fields: + +```json +{ "where": { "ids": [ 310, 311 ] } } +``` + +Example 2 output: + +```json +{ + "items": [ + { + "id": 310, + "status": "inherit", + "date": { "site": "2026-10-21T09:30:00+01:00", "gmt": "2026-10-21T08:30:00+00:00" }, + "slug": "team-photo", + "title": { "rendered": "Team photo" }, + "media_type": "image", + "mime_type": "image/jpeg", + "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo.jpg" + }, + { + "id": 311, + "status": "inherit", + "date": { "site": "2026-10-20T16:00:00+01:00", "gmt": "2026-10-20T15:00:00+00:00" }, + "slug": "press-kit", + "title": { "rendered": "Press kit" }, + "media_type": "file", + "mime_type": "application/pdf", + "source_url": "https://example.test/wp-content/uploads/2026/10/press-kit.pdf" + } + ], + "pagination": { "total": 2, "total_pages": 1 } +} +``` + +Example 3 input, a subscriber asking for trashed attachments: + +```json +{ "where": { "status": [ "trash" ] } } +``` + +Example 3 error: + +```json +{ "code": "media_cannot_filter_by_status", "message": "Sorry, you are not allowed to filter media by this status.", "data": { "status": 403 } } +``` + +Input schema: + +```json +{ + "type": "object", + "default": {}, + "additionalProperties": false, + "properties": { + "where": { + "type": "object", + "additionalProperties": false, + "properties": { + "ids": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "integer", "minimum": 1 } }, + "slugs": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, + "status": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "inherit", "private", "trash" ] } }, + "media_type": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "application", "audio", "image", "text", "video" ] } }, + "mime_type": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "minLength": 1 } }, + "post": { "type": "integer", "minimum": 0 }, + "author": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "id": { "type": "integer", "minimum": 1 }, + "slug": { "type": "string", "minLength": 1 } + } + } + } + }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "id", "status", "date", "date.site", "date.gmt", "modified", "modified.site", + "modified.gmt", "slug", "link", "title", "title.raw", "title.rendered", "caption", + "caption.raw", "caption.rendered", "description", "description.raw", + "description.rendered", "alt_text", "media_type", "mime_type", "source_url", "filename", + "filesize", "media_details", "media_details.width", "media_details.height", + "media_details.length", "media_details.sizes", "post", "author", "author.id", + "author.name", "author.slug" + ] + } + }, + "pagination": { + "type": "object", + "additionalProperties": false, + "properties": { "page": { "type": "integer", "minimum": 1 }, "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } } + } + } +} +``` + +Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "items", "pagination" ], + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "status": { "type": "string" }, + "date": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "modified": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "caption": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "description": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "alt_text": { "type": "string" }, + "media_type": { "type": "string" }, + "mime_type": { "type": "string" }, + "source_url": { "type": "string", "format": "uri" }, + "filename": { "type": "string" }, + "filesize": { "type": "integer" }, + "media_details": { + "type": "object", + "additionalProperties": false, + "properties": { + "width": { "type": "integer" }, + "height": { "type": "integer" }, + "length": { "type": "integer" }, + "sizes": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": false, + "required": [ "width", "height", "mime_type", "source_url" ], + "properties": { "width": { "type": "integer" }, "height": { "type": "integer" }, "mime_type": { "type": "string" }, "source_url": { "type": "string", "format": "uri" } } + } + } + } + }, + "post": { "type": "integer" }, + "author": { + "type": "object", + "additionalProperties": false, + "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + } + } + } + }, + "pagination": { + "type": "object", + "additionalProperties": false, + "required": [ "total", "total_pages" ], + "properties": { "total": { "type": "integer" }, "total_pages": { "type": "integer" } } + } + } +} +``` + +### `core/media-upload` + +Example 1 input, an image from a URL, attached to post 123: + +```json +{ + "data": { + "file": { "url": "https://cdn.example.test/press/team-photo.jpg" }, + "title": "Team photo", + "alt_text": "The team on the office roof", + "post": 123 + }, + "fields": [ "title.rendered", "alt_text", "mime_type", "source_url", "media_details", "post" ] +} +``` + +Example 1 output: + +```json +{ + "id": 310, + "title": { "rendered": "Team photo" }, + "alt_text": "The team on the office roof", + "mime_type": "image/jpeg", + "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo.jpg", + "media_details": { + "width": 2048, + "height": 1365, + "sizes": { + "thumbnail": { "width": 150, "height": 150, "mime_type": "image/jpeg", "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo-150x150.jpg" }, + "medium": { "width": 300, "height": 200, "mime_type": "image/jpeg", "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo-300x200.jpg" }, + "large": { "width": 1024, "height": 683, "mime_type": "image/jpeg", "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo-1024x683.jpg" } + } + }, + "post": 123 +} +``` + +Example 2 input, a PDF from inline bytes with the default fields: + +```json +{ + "data": { + "file": { "base64": "JVBERi0xLjcKJeLjz9MK…", "filename": "press-kit.pdf" }, + "title": "Press kit" + } +} +``` + +Example 2 output: + +```json +{ + "id": 311, + "status": "inherit", + "date": { "site": "2026-10-20T16:00:00+01:00", "gmt": "2026-10-20T15:00:00+00:00" }, + "slug": "press-kit", + "title": { "rendered": "Press kit" }, + "media_type": "file", + "mime_type": "application/pdf", + "source_url": "https://example.test/wp-content/uploads/2026/10/press-kit.pdf" +} +``` + +Example 3 input, the same PDF given as a URL: + +```json +{ "data": { "file": { "url": "https://cdn.example.test/press/press-kit.pdf" } } } +``` + +Example 3 error: + +```json +{ + "code": "media_invalid_file", + "message": "Only images can be uploaded from a URL.", + "data": { "status": 400, "params": { "data[file][url]": "Only images can be uploaded from a URL." } } +} +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "data" ], + "properties": { + "data": { + "type": "object", + "additionalProperties": false, + "required": [ "file" ], + "properties": { + "file": { + "anyOf": [ + { "type": "object", "additionalProperties": false, "required": [ "url" ], "properties": { "url": { "type": "string", "format": "uri" } } }, + { + "type": "object", + "additionalProperties": false, + "required": [ "base64", "filename" ], + "properties": { "base64": { "type": "string", "minLength": 1 }, "filename": { "type": "string", "minLength": 1 } } + } + ] + }, + "title": { "type": "string" }, + "caption": { "type": "string" }, + "description": { "type": "string" }, + "alt_text": { "type": "string" }, + "slug": { "type": "string", "minLength": 1 }, + "date": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { "site": { "type": "string", "format": "date-time" }, "gmt": { "type": "string", "format": "date-time" } } + }, + "author": { "type": "integer", "minimum": 1 }, + "post": { "type": "integer", "minimum": 1 } + } + }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "id", "status", "date", "date.site", "date.gmt", "modified", "modified.site", + "modified.gmt", "slug", "link", "title", "title.raw", "title.rendered", "caption", + "caption.raw", "caption.rendered", "description", "description.raw", + "description.rendered", "alt_text", "media_type", "mime_type", "source_url", "filename", + "filesize", "media_details", "media_details.width", "media_details.height", + "media_details.length", "media_details.sizes", "post", "author", "author.id", + "author.name", "author.slug" + ] + } + } + } +} +``` + +Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. + +`data.date` takes `site`, `gmt` or both; `site` wins when both are sent. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "status": { "type": "string" }, + "date": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "modified": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "caption": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "description": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "alt_text": { "type": "string" }, + "media_type": { "type": "string" }, + "mime_type": { "type": "string" }, + "source_url": { "type": "string", "format": "uri" }, + "filename": { "type": "string" }, + "filesize": { "type": "integer" }, + "media_details": { + "type": "object", + "additionalProperties": false, + "properties": { + "width": { "type": "integer" }, + "height": { "type": "integer" }, + "length": { "type": "integer" }, + "sizes": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": false, + "required": [ "width", "height", "mime_type", "source_url" ], + "properties": { "width": { "type": "integer" }, "height": { "type": "integer" }, "mime_type": { "type": "string" }, "source_url": { "type": "string", "format": "uri" } } + } + } + } + }, + "post": { "type": "integer" }, + "author": { + "type": "object", + "additionalProperties": false, + "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + } + } +} +``` + +### `core/media-update` + +Example 1 input, a caption and a new alt text: + +```json +{ + "where": { "id": 310 }, + "data": { "caption": "October 2026", "alt_text": "The team on the office roof, October 2026" }, + "fields": [ "caption", "alt_text" ] +} +``` + +Example 1 output: + +```json +{ + "id": 310, + "caption": { "raw": "October 2026", "rendered": "

October 2026

\n" }, + "alt_text": "The team on the office roof, October 2026" +} +``` + +Example 2 input, detaching the press kit from its post: + +```json +{ "where": { "id": 311 }, "data": { "post": 0 }, "fields": [ "post" ] } +``` + +Example 2 output: + +```json +{ "id": 311, "post": 0 } +``` + +Example 3 input, attaching it to a post the user cannot edit: + +```json +{ "where": { "id": 311 }, "data": { "post": 7 } } +``` + +Example 3 error: + +```json +{ "code": "media_cannot_attach", "message": "Sorry, you are not allowed to attach media to this post.", "data": { "status": 403 } } +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where", "data" ], + "properties": { + "where": { "type": "object", "additionalProperties": false, "required": [ "id" ], "properties": { "id": { "type": "integer", "minimum": 1 } } }, + "data": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "title": { "type": "string" }, + "caption": { "type": "string" }, + "description": { "type": "string" }, + "alt_text": { "type": "string" }, + "slug": { "type": "string", "minLength": 1 }, + "date": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { "site": { "type": "string", "format": "date-time" }, "gmt": { "type": "string", "format": "date-time" } } + }, + "author": { "type": "integer", "minimum": 1 }, + "post": { "type": "integer", "minimum": 0 } + } + }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "id", "status", "date", "date.site", "date.gmt", "modified", "modified.site", + "modified.gmt", "slug", "link", "title", "title.raw", "title.rendered", "caption", + "caption.raw", "caption.rendered", "description", "description.raw", + "description.rendered", "alt_text", "media_type", "mime_type", "source_url", "filename", + "filesize", "media_details", "media_details.width", "media_details.height", + "media_details.length", "media_details.sizes", "post", "author", "author.id", + "author.name", "author.slug" + ] + } + } + } +} +``` + +Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. + +`data.date` takes `site`, `gmt` or both; `site` wins when both are sent. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "status": { "type": "string" }, + "date": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "modified": { + "type": "object", + "additionalProperties": false, + "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "caption": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "description": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, + "alt_text": { "type": "string" }, + "media_type": { "type": "string" }, + "mime_type": { "type": "string" }, + "source_url": { "type": "string", "format": "uri" }, + "filename": { "type": "string" }, + "filesize": { "type": "integer" }, + "media_details": { + "type": "object", + "additionalProperties": false, + "properties": { + "width": { "type": "integer" }, + "height": { "type": "integer" }, + "length": { "type": "integer" }, + "sizes": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": false, + "required": [ "width", "height", "mime_type", "source_url" ], + "properties": { "width": { "type": "integer" }, "height": { "type": "integer" }, "mime_type": { "type": "string" }, "source_url": { "type": "string", "format": "uri" } } + } + } + } + }, + "post": { "type": "integer" }, + "author": { + "type": "object", + "additionalProperties": false, + "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + } + } +} +``` + +### `core/media-delete` + +Example 1 input, a permanent deletion: + +```json +{ "where": { "id": 310 }, "permanent": true } +``` + +Over REST: + +```http +DELETE /wp-json/wp-abilities/v1/abilities/core/media-delete/run?input[where][id]=310&input[permanent]=true +``` + +Example 1 output: + +```json +{ "outcome": "deleted" } +``` + +Example 2 input, the same call without `permanent` on a site where the media trash is off: + +```json +{ "where": { "id": 310 } } +``` + +Example 2 error: + +```json +{ "code": "media_trash_not_supported", "message": "The attachment does not support trashing. Set \"permanent\" to delete it.", "data": { "status": 501 } } +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where" ], + "properties": { + "where": { "type": "object", "additionalProperties": false, "required": [ "id" ], "properties": { "id": { "type": "integer", "minimum": 1 } } }, + "permanent": { "type": "boolean" } + } +} +``` + +When `MEDIA_TRASH` is off, which is the default, `permanent: true` is required: an attachment cannot be trashed there, only deleted. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "outcome" ], + "properties": { "outcome": { "type": "string" } } +} +``` + +## Term abilities + +### `core/terms-query` + +Example 1 input, the top-level categories, two per page: + +```json +{ + "where": { "taxonomy": "category", "parent": 0 }, + "fields": [ "name", "slug", "count" ], + "pagination": { "per_page": 2 } +} +``` + +Example 1 output: + +```json +{ + "items": [ + { "id": 3, "name": "News", "slug": "news", "count": 12 }, + { "id": 1, "name": "Uncategorized", "slug": "uncategorized", "count": 4 } + ], + "pagination": { "total": 5, "total_pages": 3 } +} +``` + +Example 2 input, the tags of post 123 with the default fields: + +```json +{ "where": { "taxonomy": "post_tag", "post": 123 } } +``` + +Example 2 output: + +```json +{ + "items": [ + { "id": 15, "taxonomy": "post_tag", "name": "beta", "slug": "beta", "link": "https://example.test/tag/beta/" } + ], + "pagination": { "total": 1, "total_pages": 1 } +} +``` + +Example 3 input, `parent` on a flat taxonomy: + +```json +{ "where": { "taxonomy": "post_tag", "parent": 0 } } +``` + +Example 3 error: + +```json +{ + "code": "terms_invalid_filter", + "message": "The \"post_tag\" taxonomy is not hierarchical.", + "data": { "status": 400, "params": { "where[parent]": "The \"post_tag\" taxonomy is not hierarchical." } } +} +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where" ], + "properties": { + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "taxonomy" ], + "properties": { + "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, + "ids": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "integer", "minimum": 1 } }, + "slugs": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, + "parent": { "type": "integer", "minimum": 0 }, + "post": { "type": "integer", "minimum": 1 }, + "hide_empty": { "type": "boolean" } + } + }, + "fields": { "type": "array", "uniqueItems": true, "items": { "type": "string", "enum": [ "id", "taxonomy", "name", "slug", "description", "parent", "count", "link" ] } }, + "pagination": { + "type": "object", + "additionalProperties": false, + "properties": { "page": { "type": "integer", "minimum": 1 }, "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } } + } + } +} +``` + +Default `fields`: `id, taxonomy, name, slug, link`. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "items", "pagination" ], + "properties": { + "items": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "taxonomy": { "type": "string" }, + "name": { "type": "string" }, + "slug": { "type": "string" }, + "description": { "type": "string" }, + "parent": { "type": "integer" }, + "count": { "type": "integer" }, + "link": { "type": "string", "format": "uri" } + } + } + }, + "pagination": { + "type": "object", + "additionalProperties": false, + "required": [ "total", "total_pages" ], + "properties": { "total": { "type": "integer" }, "total_pages": { "type": "integer" } } + } + } +} +``` + +### `core/term-create` + +Example 1 input, a child category under News: + +```json +{ + "data": { "taxonomy": "category", "name": "Product updates", "parent": 3 }, + "fields": [ "name", "slug", "parent", "link" ] +} +``` + +Example 1 output: + +```json +{ + "id": 9, + "name": "Product updates", + "slug": "product-updates", + "parent": 3, + "link": "https://example.test/category/news/product-updates/" +} +``` + +Example 2 input, a tag with the default fields: + +```json +{ "data": { "taxonomy": "post_tag", "name": "beta" } } +``` + +Example 2 output: + +```json +{ "id": 15, "taxonomy": "post_tag", "name": "beta", "slug": "beta", "link": "https://example.test/tag/beta/" } +``` + +Example 3 error, the first call repeated: + +```json +{ + "code": "term_exists", + "message": "A term with the name provided already exists with this parent.", + "data": { "status": 400, "term_id": 9 } +} +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "data" ], + "properties": { + "data": { + "type": "object", + "additionalProperties": false, + "required": [ "taxonomy", "name" ], + "properties": { + "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, + "name": { "type": "string", "minLength": 1 }, + "slug": { "type": "string", "minLength": 1 }, + "description": { "type": "string" }, + "parent": { "type": "integer", "minimum": 0 } + } + }, + "fields": { "type": "array", "uniqueItems": true, "items": { "type": "string", "enum": [ "id", "taxonomy", "name", "slug", "description", "parent", "count", "link" ] } } + } +} +``` + +Default `fields`: `id, taxonomy, name, slug, link`. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "taxonomy": { "type": "string" }, + "name": { "type": "string" }, + "slug": { "type": "string" }, + "description": { "type": "string" }, + "parent": { "type": "integer" }, + "count": { "type": "integer" }, + "link": { "type": "string", "format": "uri" } + } +} +``` + +### `core/term-update` + +Example 1 input, a description: + +```json +{ + "where": { "taxonomy": "category", "id": 9 }, + "data": { "description": "Release notes and roadmap updates." }, + "fields": [ "name", "description" ] +} +``` + +Example 1 output: + +```json +{ "id": 9, "name": "Product updates", "description": "Release notes and roadmap updates." } +``` + +Example 2 input, moving the category to the top level, which changes its link: + +```json +{ "where": { "taxonomy": "category", "id": 9 }, "data": { "parent": 0 }, "fields": [ "name", "parent", "link" ] } +``` + +Example 2 output: + +```json +{ "id": 9, "name": "Product updates", "parent": 0, "link": "https://example.test/category/product-updates/" } +``` + +Example 3 input, a term that is not in the taxonomy named in `where`: + +```json +{ "where": { "taxonomy": "post_tag", "id": 9 }, "data": { "name": "Product updates" } } +``` + +Example 3 error: + +```json +{ "code": "term_not_found", "message": "The requested term was not found.", "data": { "status": 404 } } +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where", "data" ], + "properties": { + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "taxonomy", "id" ], + "properties": { "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, "id": { "type": "integer", "minimum": 1 } } + }, + "data": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "name": { "type": "string", "minLength": 1 }, + "slug": { "type": "string", "minLength": 1 }, + "description": { "type": "string" }, + "parent": { "type": "integer", "minimum": 0 } + } + }, + "fields": { "type": "array", "uniqueItems": true, "items": { "type": "string", "enum": [ "id", "taxonomy", "name", "slug", "description", "parent", "count", "link" ] } } + } +} +``` + +Default `fields`: `id, taxonomy, name, slug, link`. + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { + "id": { "type": "integer" }, + "taxonomy": { "type": "string" }, + "name": { "type": "string" }, + "slug": { "type": "string" }, + "description": { "type": "string" }, + "parent": { "type": "integer" }, + "count": { "type": "integer" }, + "link": { "type": "string", "format": "uri" } + } +} +``` + +### `core/term-delete` + +Example 1 input, deleting a tag: + +```json +{ "where": { "taxonomy": "post_tag", "id": 15 } } +``` + +Over REST: + +```http +DELETE /wp-json/wp-abilities/v1/abilities/core/term-delete/run?input[where][taxonomy]=post_tag&input[where][id]=15 +``` + +Example 1 output: + +```json +{ "outcome": "deleted" } +``` + +Example 2 input, the default category is refused: + +```json +{ "where": { "taxonomy": "category", "id": 1 } } +``` + +Example 2 error: + +```json +{ "code": "term_is_default", "message": "The default category cannot be deleted.", "data": { "status": 400 } } +``` + +Input schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "where" ], + "properties": { + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "taxonomy", "id" ], + "properties": { "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, "id": { "type": "integer", "minimum": 1 } } + } + } +} +``` + +Output schema: + +```json +{ + "type": "object", + "additionalProperties": false, + "required": [ "outcome" ], + "properties": { "outcome": { "type": "string" } } +} +``` diff --git a/NAME-LIFECYCLE.md b/NAME-LIFECYCLE.md index 3356d94..bfa4c58 100644 --- a/NAME-LIFECYCLE.md +++ b/NAME-LIFECYCLE.md @@ -21,7 +21,8 @@ shipped): 1. **Incubate:** `wp/post-update` iterates and gets tested through the MCP adapter against real tasks. Names and schema may still change freely. -2. **Ready:** file the core proposal (a trac ticket or GitHub issue). +2. **Ready:** file the core proposal (a trac ticket or GitHub issue). The + target name and schema of each ability are in [CORE-SHAPE.md](CORE-SHAPE.md). 3. **Same release:** rename to `core/post-update` — tier becomes `stable`, the manifest entry gains its `proposal` URL, and the schema is frozen (backwards compatible from this moment). diff --git a/README.md b/README.md index c22ac65..dcf0a78 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,10 @@ Full rules, the promotion path, and the rename protocol are in ### Current abilities +The target shape of every ability — its name, input and output schemas, and +examples — is in [CORE-SHAPE.md](CORE-SHAPE.md). Where the table below or the +code differs from it, the code is being updated to match. + | Name | Tier | Category | Notes | |---|---|---|---| | `core/content-query` | core | content | Backport of the readonly content query ability landed in WordPress core 7.2 (`core_since: 7.2`). On 7.2+ core provides it and the Registrar skips it; on 6.9–7.1 the package serves it under the same name. Requires the `show_in_abilities` support feature (polyfilled where core lacks it). | From 31e7823f5c4aa45d58fed0a725541ed5ad7b9037 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 13 Nov 2026 21:23:03 +0000 Subject: [PATCH 02/13] CORE-SHAPE.md: lay out each ability for review on GitHub Same content, reorganized: - Each example is one block: its input, REST call, and output or error together, labelled with comments. - An ability's notes (default fields, special cases) come first, as a list, before its examples. - Input and output schemas sit in collapsible sections. - Schemas put every field of a properties map on its own line, so a review comment can target a single field, and no JSON line runs past 100 characters except unbreakable strings and URLs. - The summary table links each ability to its section, splits the annotations into their own columns, and links the landed commits. --- CORE-SHAPE.md | 1858 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 1208 insertions(+), 650 deletions(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index 6c1fb7a..b5e7852 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -1,45 +1,44 @@ # Core Abilities Schema Quick Reference -This document is the source of truth for the shape of the core abilities: -their names, input and output schemas, and behavior. Where the package code -differs, the code is updated to match it. - -| Ability | Status | Category | readonly / destructive / idempotent | REST transport method | -|---|---|---|---|---| -| `core/content-query` | Landed, 213ecca2e9 | content | true / false / true | GET | -| `core/content-create` | Proposed | content | false / false / false | POST | -| `core/content-update` | Proposed | content | false / false / true | POST | -| `core/content-delete` | Proposed | content | false / true / true | DELETE | -| `core/settings-get` | Landed, b6512b1e8c | site | true / false / true | GET | -| `core/settings-update` | Proposed | site | false / false / true | POST | -| `core/users-query` | Landed, 39981fd0fe | user | true / false / true | GET | -| `core/user-create` | Proposed | user | false / false / false | POST | -| `core/user-update` | Proposed | user | false / false / true | POST | -| `core/user-delete` | Proposed | user | false / true / true | DELETE | -| `core/media-query` | Proposed | content | true / false / true | GET | -| `core/media-upload` | Proposed | content | false / false / false | POST | -| `core/media-update` | Proposed | content | false / false / true | POST | -| `core/media-delete` | Proposed | content | false / true / true | DELETE | -| `core/terms-query` | Proposed | content | true / false / true | GET | -| `core/term-create` | Proposed | content | false / false / false | POST | -| `core/term-update` | Proposed | content | false / false / true | POST | -| `core/term-delete` | Proposed | content | false / true / true | DELETE | - -Errors are `WP_Error` objects. Each "Example N error" block shows one as the REST response body (`code`, `message`, `data`); errors are not validated against the output schema. +This document is the source of truth for the shape of the core abilities: their names, input and output schemas, and behavior. Where the package code differs, the code is updated to match it. + +| Ability | Status | Category | `readonly` | `destructive` | `idempotent` | REST method | +|---|---|---|---|---|---|---| +| [`core/content-query`](#corecontent-query) | Landed, [`213ecca2e9`](https://github.com/WordPress/wordpress-develop/commit/213ecca2e96) | content | `true` | `false` | `true` | `GET` | +| [`core/content-create`](#corecontent-create) | Proposed | content | `false` | `false` | `false` | `POST` | +| [`core/content-update`](#corecontent-update) | Proposed | content | `false` | `false` | `true` | `POST` | +| [`core/content-delete`](#corecontent-delete) | Proposed | content | `false` | `true` | `true` | `DELETE` | +| [`core/settings-get`](#coresettings-get) | Landed, [`b6512b1e8c`](https://github.com/WordPress/wordpress-develop/commit/b6512b1e8ca) | site | `true` | `false` | `true` | `GET` | +| [`core/settings-update`](#coresettings-update) | Proposed | site | `false` | `false` | `true` | `POST` | +| [`core/users-query`](#coreusers-query) | Landed, [`39981fd0fe`](https://github.com/WordPress/wordpress-develop/commit/39981fd0fef) | user | `true` | `false` | `true` | `GET` | +| [`core/user-create`](#coreuser-create) | Proposed | user | `false` | `false` | `false` | `POST` | +| [`core/user-update`](#coreuser-update) | Proposed | user | `false` | `false` | `true` | `POST` | +| [`core/user-delete`](#coreuser-delete) | Proposed | user | `false` | `true` | `true` | `DELETE` | +| [`core/media-query`](#coremedia-query) | Proposed | content | `true` | `false` | `true` | `GET` | +| [`core/media-upload`](#coremedia-upload) | Proposed | content | `false` | `false` | `false` | `POST` | +| [`core/media-update`](#coremedia-update) | Proposed | content | `false` | `false` | `true` | `POST` | +| [`core/media-delete`](#coremedia-delete) | Proposed | content | `false` | `true` | `true` | `DELETE` | +| [`core/terms-query`](#coreterms-query) | Proposed | content | `true` | `false` | `true` | `GET` | +| [`core/term-create`](#coreterm-create) | Proposed | content | `false` | `false` | `false` | `POST` | +| [`core/term-update`](#coreterm-update) | Proposed | content | `false` | `false` | `true` | `POST` | +| [`core/term-delete`](#coreterm-delete) | Proposed | content | `false` | `true` | `true` | `DELETE` | + +Errors are `WP_Error` objects. The `// Error` part of an example shows one as the REST response body (`code`, `message`, `data`); errors are not validated against the output schema. ## Content abilities ### `core/content-query` -Example 1 input, the drafts of the `post` type with chosen fields: +- Default `fields`: `id, type, status, date, slug, title.rendered`. +- Trashed posts cannot be read today: `where.status` has no `trash` value. It gets one when `core/content-delete` is added. -```json -{ "where": { "type": "post", "status": [ "draft" ] }, "fields": [ "title", "date", "author" ] } -``` +**Example 1:** the drafts of the `post` type with chosen fields -Example 1 output: +```jsonc +// Input +{ "where": { "type": "post", "status": [ "draft" ] }, "fields": [ "title", "date", "author" ] } -```json +// Output { "items": [ { @@ -53,15 +52,13 @@ Example 1 output: } ``` -Example 2 input, the child pages of page 7, two per page, with the default fields: +**Example 2:** the child pages of page 7, two per page, with the default fields -```json +```jsonc +// Input { "where": { "type": "page", "parent": 7 }, "pagination": { "per_page": 2 } } -``` - -Example 2 output: -```json +// Output { "items": [ { @@ -85,23 +82,27 @@ Example 2 output: } ``` -Example 3 input, `parent` on a flat type: +**Example 3:** `parent` on a flat type -```json +```jsonc +// Input { "where": { "type": "post", "parent": 7 } } -``` - -Example 3 error: -```json +// Error { "code": "content_invalid_filter", "message": "The parent filter is only supported for hierarchical post types.", - "data": { "status": 400, "params": { "where[parent]": "The parent filter is only supported for hierarchical post types." } } + "data": { + "status": 400, + "params": { + "where[parent]": "The parent filter is only supported for hierarchical post types." + } + } } ``` -Input schema: +
+Input schema ```json { @@ -114,10 +115,30 @@ Input schema: "additionalProperties": false, "required": [ "type" ], "properties": { - "type": { "type": "string", "enum": [ "post", "page" ] }, - "ids": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "integer", "minimum": 1 } }, - "slugs": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, - "status": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "publish", "future", "draft", "pending", "private" ] } }, + "type": { "type": "string", "enum": [ "post", "page" ] }, + "ids": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "maxItems": 100, + "items": { "type": "integer", "minimum": 1 } + }, + "slugs": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "maxItems": 100, + "items": { "type": "string", "minLength": 1 } + }, + "status": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "type": "string", + "enum": [ "publish", "future", "draft", "pending", "private" ] + } + }, "author": { "type": "object", "additionalProperties": false, @@ -147,17 +168,19 @@ Input schema: "pagination": { "type": "object", "additionalProperties": false, - "properties": { "page": { "type": "integer", "minimum": 1 }, "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } } + "properties": { + "page": { "type": "integer", "minimum": 1 }, + "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } + } } } } ``` -Default `fields`: `id, type, status, date, slug, title.rendered`. +
-Trashed posts cannot be read today: `where.status` has no `trash` value. It gets one when `core/content-delete` is added. - -Output schema: +
+Output schema ```json { @@ -172,30 +195,63 @@ Output schema: "additionalProperties": false, "required": [ "id" ], "properties": { - "id": { "type": "integer" }, - "type": { "type": "string" }, - "status": { "type": "string" }, + "id": { "type": "integer" }, + "type": { "type": "string" }, + "status": { "type": "string" }, "date": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } }, "modified": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "excerpt": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" }, + "protected": { "type": "boolean" } + } + }, + "content": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" }, + "protected": { "type": "boolean" } + } }, - "slug": { "type": "string" }, - "link": { "type": "string", "format": "uri" }, - "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "excerpt": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, - "content": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, "author": { "type": "object", "additionalProperties": false, - "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + "properties": { + "id": { "type": "integer" }, + "name": { "type": [ "string", "null" ] }, + "slug": { "type": [ "string", "null" ] } + } }, - "parent": { "type": "integer" } + "parent": { "type": "integer" } } } }, @@ -203,23 +259,29 @@ Output schema: "type": "object", "additionalProperties": false, "required": [ "total", "total_pages" ], - "properties": { "total": { "type": "integer" }, "total_pages": { "type": "integer" } } + "properties": { + "total": { "type": "integer" }, + "total_pages": { "type": "integer" } + } } } } ``` +
+ ### `core/content-create` -Example 1 input, a draft with the default fields: +- Default `fields`: `id, type, status, date, slug, title.rendered`. +- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. -```json -{ "data": { "type": "post", "title": "Launch notes" } } -``` +**Example 1:** a draft with the default fields -Example 1 output: +```jsonc +// Input +{ "data": { "type": "post", "title": "Launch notes" } } -```json +// Output { "id": 123, "type": "post", @@ -230,9 +292,10 @@ Example 1 output: } ``` -Example 2 input, a published child page with chosen fields: +**Example 2:** a published child page with chosen fields -```json +```jsonc +// Input { "data": { "type": "page", @@ -244,11 +307,8 @@ Example 2 input, a published child page with chosen fields: }, "fields": [ "status", "link", "title.rendered", "content.rendered", "parent" ] } -``` -Example 2 output: - -```json +// Output { "id": 126, "status": "publish", @@ -259,15 +319,13 @@ Example 2 output: } ``` -Example 3 input, an attribute the post type does not support: +**Example 3:** an attribute the post type does not support -```json +```jsonc +// Input { "data": { "type": "post", "title": "Launch notes", "parent": 7 } } -``` -Example 3 error: - -```json +// Error { "code": "content_invalid_attribute", "message": "Invalid attribute: parent.", @@ -275,7 +333,8 @@ Example 3 error: } ``` -Input schema: +
+Input schema ```json { @@ -292,16 +351,22 @@ Input schema: "title": { "type": "string" }, "content": { "type": "string" }, "excerpt": { "type": "string" }, - "status": { "type": "string", "enum": [ "publish", "future", "draft", "pending", "private" ] }, - "slug": { "type": "string", "minLength": 1 }, + "status": { + "type": "string", + "enum": [ "publish", "future", "draft", "pending", "private" ] + }, + "slug": { "type": "string", "minLength": 1 }, "date": { "type": "object", "additionalProperties": false, "minProperties": 1, - "properties": { "site": { "type": "string", "format": "date-time" }, "gmt": { "type": "string", "format": "date-time" } } + "properties": { + "site": { "type": "string", "format": "date-time" }, + "gmt": { "type": "string", "format": "date-time" } + } }, - "author": { "type": "integer", "minimum": 1 }, - "parent": { "type": "integer", "minimum": 0 } + "author": { "type": "integer", "minimum": 1 }, + "parent": { "type": "integer", "minimum": 0 } } }, "fields": { @@ -322,11 +387,10 @@ Input schema: } ``` -Default `fields`: `id, type, status, date, slug, title.rendered`. +
-`data.date` takes `site`, `gmt` or both; `site` wins when both are sent. - -Output schema: +
+Output schema ```json { @@ -334,82 +398,132 @@ Output schema: "additionalProperties": false, "required": [ "id" ], "properties": { - "id": { "type": "integer" }, - "type": { "type": "string" }, - "status": { "type": "string" }, + "id": { "type": "integer" }, + "type": { "type": "string" }, + "status": { "type": "string" }, "date": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } }, "modified": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "excerpt": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" }, + "protected": { "type": "boolean" } + } + }, + "content": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" }, + "protected": { "type": "boolean" } + } }, - "slug": { "type": "string" }, - "link": { "type": "string", "format": "uri" }, - "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "excerpt": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, - "content": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, "author": { "type": "object", "additionalProperties": false, - "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + "properties": { + "id": { "type": "integer" }, + "name": { "type": [ "string", "null" ] }, + "slug": { "type": [ "string", "null" ] } + } }, - "parent": { "type": "integer" } + "parent": { "type": "integer" } } } ``` +
+ ### `core/content-update` -Example 1 input, a new title and excerpt: +- Default `fields`: `id, type, status, date, slug, title.rendered`. +- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. -```json +**Example 1:** a new title and excerpt + +```jsonc +// Input { "where": { "type": "post", "id": 123 }, "data": { "title": "Launch notes, updated", "excerpt": "What shipped and what is next." }, "fields": [ "modified", "title", "excerpt" ] } -``` -Example 1 output: - -```json +// Output { "id": 123, "modified": { "site": "2026-10-21T10:05:00+01:00", "gmt": "2026-10-21T09:05:00+00:00" }, "title": { "raw": "Launch notes, updated", "rendered": "Launch notes, updated" }, - "excerpt": { "raw": "What shipped and what is next.", "rendered": "

What shipped and what is next.

\n", "protected": false } + "excerpt": { + "raw": "What shipped and what is next.", + "rendered": "

What shipped and what is next.

\n", + "protected": false + } } ``` -Example 2 input, publishing the draft: - -```json -{ "where": { "type": "post", "id": 123 }, "data": { "status": "publish" }, "fields": [ "status", "slug", "link" ] } -``` +**Example 2:** publishing the draft -Example 2 output: +```jsonc +// Input +{ + "where": { "type": "post", "id": 123 }, + "data": { "status": "publish" }, + "fields": [ "status", "slug", "link" ] +} -```json -{ "id": 123, "status": "publish", "slug": "launch-notes-updated", "link": "https://example.test/launch-notes-updated/" } +// Output +{ + "id": 123, + "status": "publish", + "slug": "launch-notes-updated", + "link": "https://example.test/launch-notes-updated/" +} ``` -Example 3 input, a post the user cannot edit: +**Example 3:** a post the user cannot edit -```json +```jsonc +// Input { "where": { "type": "post", "id": 123 }, "data": { "title": "Launch notes" } } -``` -Example 3 error: - -```json -{ "code": "content_cannot_edit", "message": "Sorry, you are not allowed to edit this post.", "data": { "status": 403 } } +// Error +{ + "code": "content_cannot_edit", + "message": "Sorry, you are not allowed to edit this post.", + "data": { "status": 403 } +} ``` -Input schema: +
+Input schema ```json { @@ -421,7 +535,10 @@ Input schema: "type": "object", "additionalProperties": false, "required": [ "type", "id" ], - "properties": { "type": { "type": "string", "enum": [ "post", "page" ] }, "id": { "type": "integer", "minimum": 1 } } + "properties": { + "type": { "type": "string", "enum": [ "post", "page" ] }, + "id": { "type": "integer", "minimum": 1 } + } }, "data": { "type": "object", @@ -431,16 +548,22 @@ Input schema: "title": { "type": "string" }, "content": { "type": "string" }, "excerpt": { "type": "string" }, - "status": { "type": "string", "enum": [ "publish", "future", "draft", "pending", "private" ] }, - "slug": { "type": "string", "minLength": 1 }, + "status": { + "type": "string", + "enum": [ "publish", "future", "draft", "pending", "private" ] + }, + "slug": { "type": "string", "minLength": 1 }, "date": { "type": "object", "additionalProperties": false, "minProperties": 1, - "properties": { "site": { "type": "string", "format": "date-time" }, "gmt": { "type": "string", "format": "date-time" } } + "properties": { + "site": { "type": "string", "format": "date-time" }, + "gmt": { "type": "string", "format": "date-time" } + } }, - "author": { "type": "integer", "minimum": 1 }, - "parent": { "type": "integer", "minimum": 0 } + "author": { "type": "integer", "minimum": 1 }, + "parent": { "type": "integer", "minimum": 0 } } }, "fields": { @@ -461,11 +584,10 @@ Input schema: } ``` -Default `fields`: `id, type, status, date, slug, title.rendered`. +
-`data.date` takes `site`, `gmt` or both; `site` wins when both are sent. - -Output schema: +
+Output schema ```json { @@ -473,79 +595,112 @@ Output schema: "additionalProperties": false, "required": [ "id" ], "properties": { - "id": { "type": "integer" }, - "type": { "type": "string" }, - "status": { "type": "string" }, + "id": { "type": "integer" }, + "type": { "type": "string" }, + "status": { "type": "string" }, "date": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } }, "modified": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "excerpt": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" }, + "protected": { "type": "boolean" } + } + }, + "content": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" }, + "protected": { "type": "boolean" } + } }, - "slug": { "type": "string" }, - "link": { "type": "string", "format": "uri" }, - "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "excerpt": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, - "content": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" }, "protected": { "type": "boolean" } } }, "author": { "type": "object", "additionalProperties": false, - "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + "properties": { + "id": { "type": "integer" }, + "name": { "type": [ "string", "null" ] }, + "slug": { "type": [ "string", "null" ] } + } }, - "parent": { "type": "integer" } + "parent": { "type": "integer" } } } ``` -### `core/content-delete` +
-Example 1 input, trashing a post: +### `core/content-delete` -```json -{ "where": { "type": "post", "id": 123 } } -``` +- When this ability is added, `core/content-query` takes `trash` in `where.status`, so trashed posts can be read. -Over REST: +**Example 1:** trashing a post -```http -DELETE /wp-json/wp-abilities/v1/abilities/core/content-delete/run?input[where][type]=post&input[where][id]=123 -``` +```jsonc +// Input +{ "where": { "type": "post", "id": 123 } } -Example 1 output: +// Over REST +// DELETE /wp-json/wp-abilities/v1/abilities/core/content-delete/run?input[where][type]=post&input[where][id]=123 -```json +// Output { "outcome": "trashed" } ``` -Example 2 input, deleting a page permanently: +**Example 2:** deleting a page permanently -```json +```jsonc +// Input { "where": { "type": "page", "id": 126 }, "permanent": true } -``` -Example 2 output: - -```json +// Output { "outcome": "deleted" } ``` -Example 3 input, trashing the post of example 1 again: +**Example 3:** trashing the post of example 1 again -```json +```jsonc +// Input { "where": { "type": "post", "id": 123 } } -``` -Example 3 error: - -```json -{ "code": "content_already_trashed", "message": "The post has already been trashed.", "data": { "status": 410 } } +// Error +{ + "code": "content_already_trashed", + "message": "The post has already been trashed.", + "data": { "status": 410 } +} ``` -Input schema: +
+Input schema ```json { @@ -557,16 +712,20 @@ Input schema: "type": "object", "additionalProperties": false, "required": [ "type", "id" ], - "properties": { "type": { "type": "string", "enum": [ "post", "page" ] }, "id": { "type": "integer", "minimum": 1 } } + "properties": { + "type": { "type": "string", "enum": [ "post", "page" ] }, + "id": { "type": "integer", "minimum": 1 } + } }, "permanent": { "type": "boolean" } } } ``` -When this ability is added, `core/content-query` takes `trash` in `where.status`, so trashed posts can be read. +
-Output schema: +
+Output schema ```json { @@ -577,35 +736,40 @@ Output schema: } ``` +
+ ## Settings abilities ### `core/settings-get` -Example 1 input, one group: +**Example 1:** one group -```json +```jsonc +// Input { "group": "reading" } -``` - -Example 1 output: -```json -{ "posts_per_page": 10, "show_on_front": "posts", "page_on_front": 0, "page_for_posts": 0, "page_for_privacy_policy": 3 } +// Output +{ + "posts_per_page": 10, + "show_on_front": "posts", + "page_on_front": 0, + "page_for_posts": 0, + "page_for_privacy_policy": 3 +} ``` -Example 2 input, two named settings: +**Example 2:** two named settings -```json +```jsonc +// Input { "fields": [ "title", "timezone" ] } -``` - -Example 2 output: -```json +// Output { "title": "Acme Robotics", "timezone": "Europe/Lisbon" } ``` -Input schema: +
+Input schema ```json { @@ -613,20 +777,28 @@ Input schema: "default": {}, "additionalProperties": false, "properties": { - "group": { "type": "string", "enum": [ "general", "writing", "reading", "discussion" ] }, + "group": { "type": "string", "enum": [ "general", "writing", "reading", "discussion" ] }, "fields": { "type": "array", "uniqueItems": true, "items": { "type": "string", - "enum": [ "title", "description", "url", "email", "timezone", "date_format", "time_format", "start_of_week", "language", "use_smilies", "default_category", "default_post_format", "posts_per_page", "show_on_front", "page_on_front", "page_for_posts", "page_for_privacy_policy", "default_ping_status", "default_comment_status" ] + "enum": [ + "title", "description", "url", "email", "timezone", "date_format", "time_format", + "start_of_week", "language", "use_smilies", "default_category", "default_post_format", + "posts_per_page", "show_on_front", "page_on_front", "page_for_posts", + "page_for_privacy_policy", "default_ping_status", "default_comment_status" + ] } } } } ``` -Output schema: +
+ +
+Output schema ```json { @@ -656,48 +828,41 @@ Output schema: } ``` +
+ ### `core/settings-update` -Example 1 input, a title, a reading option and a deleted option: +**Example 1:** a title, a reading option and a deleted option -```json +```jsonc +// Input { "data": { "title": "Acme Robotics", "posts_per_page": 12, "use_smilies": null } } -``` - -Over REST: -```http -POST /wp-json/wp-abilities/v1/abilities/core/settings-update/run +// Over REST +// POST /wp-json/wp-abilities/v1/abilities/core/settings-update/run { "input": { "data": { "title": "Acme Robotics", "posts_per_page": 12, "use_smilies": null } } } -``` - -Example 1 output: -```json +// Output { "title": "Acme Robotics", "posts_per_page": 12, "use_smilies": true } ``` -Example 2 input, closing discussion on new posts: +**Example 2:** closing discussion on new posts -```json +```jsonc +// Input { "data": { "default_comment_status": "closed", "default_ping_status": "closed" } } -``` - -Example 2 output: -```json +// Output { "default_comment_status": "closed", "default_ping_status": "closed" } ``` -Example 3 input, deleting a setting whose stored value no longer matches its schema: +**Example 3:** deleting a setting whose stored value no longer matches its schema -```json +```jsonc +// Input { "data": { "posts_per_page": null } } -``` - -Example 3 error: -```json +// Error { "code": "settings_invalid_stored_value", "message": "The posts_per_page property has an invalid stored value, and cannot be updated to null.", @@ -705,7 +870,8 @@ Example 3 error: } ``` -Input schema: +
+Input schema ```json { @@ -718,32 +884,38 @@ Input schema: "additionalProperties": false, "minProperties": 1, "properties": { - "title": { "type": [ "string", "null" ] }, - "description": { "type": [ "string", "null" ] }, - "url": { "type": [ "string", "null" ], "format": "uri" }, - "email": { "type": [ "string", "null" ], "format": "email" }, - "timezone": { "type": [ "string", "null" ] }, - "date_format": { "type": [ "string", "null" ] }, - "time_format": { "type": [ "string", "null" ] }, - "start_of_week": { "type": [ "integer", "null" ] }, - "language": { "type": [ "string", "null" ] }, - "use_smilies": { "type": [ "boolean", "null" ] }, - "default_category": { "type": [ "integer", "null" ] }, - "default_post_format": { "type": [ "string", "null" ] }, - "posts_per_page": { "type": [ "integer", "null" ] }, - "show_on_front": { "type": [ "string", "null" ] }, - "page_on_front": { "type": [ "integer", "null" ] }, - "page_for_posts": { "type": [ "integer", "null" ] }, + "title": { "type": [ "string", "null" ] }, + "description": { "type": [ "string", "null" ] }, + "url": { "type": [ "string", "null" ], "format": "uri" }, + "email": { "type": [ "string", "null" ], "format": "email" }, + "timezone": { "type": [ "string", "null" ] }, + "date_format": { "type": [ "string", "null" ] }, + "time_format": { "type": [ "string", "null" ] }, + "start_of_week": { "type": [ "integer", "null" ] }, + "language": { "type": [ "string", "null" ] }, + "use_smilies": { "type": [ "boolean", "null" ] }, + "default_category": { "type": [ "integer", "null" ] }, + "default_post_format": { "type": [ "string", "null" ] }, + "posts_per_page": { "type": [ "integer", "null" ] }, + "show_on_front": { "type": [ "string", "null" ] }, + "page_on_front": { "type": [ "integer", "null" ] }, + "page_for_posts": { "type": [ "integer", "null" ] }, "page_for_privacy_policy": { "type": [ "integer", "null" ] }, - "default_ping_status": { "type": [ "string", "null" ], "enum": [ "open", "closed", null ] }, - "default_comment_status": { "type": [ "string", "null" ], "enum": [ "open", "closed", null ] } + "default_ping_status": { "type": [ "string", "null" ], "enum": [ "open", "closed", null ] }, + "default_comment_status": { + "type": [ "string", "null" ], + "enum": [ "open", "closed", null ] + } } } } } ``` -Output schema: +
+ +
+Output schema ```json { @@ -773,34 +945,34 @@ Output schema: } ``` +
+ ## User abilities ### `core/users-query` -Example 1 input, the editors with chosen fields: +- Default `fields`: `id, name, link, slug, avatar_urls`. -```json -{ "where": { "roles": [ "editor" ] }, "fields": [ "name", "slug", "roles" ] } -``` +**Example 1:** the editors with chosen fields -Example 1 output: +```jsonc +// Input +{ "where": { "roles": [ "editor" ] }, "fields": [ "name", "slug", "roles" ] } -```json +// Output { "items": [ { "id": 42, "name": "Maya Carter", "slug": "mcarter", "roles": [ "editor" ] } ], "pagination": { "total": 1, "total_pages": 1 } } ``` -Example 2 input, the public authors with the default fields: +**Example 2:** the public authors with the default fields -```json +```jsonc +// Input { "where": { "has_published_posts": true } } -``` - -Example 2 output: -```json +// Output { "items": [ { @@ -819,19 +991,22 @@ Example 2 output: } ``` -Example 3 input, a page past the last one: +**Example 3:** a page past the last one -```json +```jsonc +// Input { "where": { "roles": [ "editor" ] }, "pagination": { "page": 2 } } -``` - -Example 3 error: -```json -{ "code": "users_invalid_page_number", "message": "The page number requested is larger than the number of pages available.", "data": { "status": 404 } } +// Error +{ + "code": "users_invalid_page_number", + "message": "The page number requested is larger than the number of pages available.", + "data": { "status": 404 } +} ``` -Input schema: +
+Input schema ```json { @@ -843,14 +1018,45 @@ Input schema: "type": "object", "additionalProperties": false, "properties": { - "ids": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "integer", "minimum": 1 } }, - "slugs": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, - "usernames": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, - "roles": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "administrator", "editor", "author", "contributor", "subscriber" ] } }, + "ids": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "maxItems": 100, + "items": { "type": "integer", "minimum": 1 } + }, + "slugs": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "maxItems": 100, + "items": { "type": "string", "minLength": 1 } + }, + "usernames": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "maxItems": 100, + "items": { "type": "string", "minLength": 1 } + }, + "roles": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "type": "string", + "enum": [ "administrator", "editor", "author", "contributor", "subscriber" ] + } + }, "has_published_posts": { "anyOf": [ { "type": "boolean", "enum": [ true ] }, - { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "post", "page", "attachment" ] } } + { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { "type": "string", "enum": [ "post", "page", "attachment" ] } + } ] } } @@ -860,21 +1066,29 @@ Input schema: "uniqueItems": true, "items": { "type": "string", - "enum": [ "id", "name", "description", "url", "link", "slug", "avatar_urls", "username", "email", "first_name", "last_name", "nickname", "locale", "registered", "registered.site", "registered.gmt", "roles" ] + "enum": [ + "id", "name", "description", "url", "link", "slug", "avatar_urls", "username", "email", + "first_name", "last_name", "nickname", "locale", "registered", "registered.site", + "registered.gmt", "roles" + ] } }, "pagination": { "type": "object", "additionalProperties": false, - "properties": { "page": { "type": "integer", "minimum": 1 }, "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } } + "properties": { + "page": { "type": "integer", "minimum": 1 }, + "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } + } } } } ``` -Default `fields`: `id, name, link, slug, avatar_urls`. +
-Output schema: +
+Output schema ```json { @@ -889,25 +1103,31 @@ Output schema: "additionalProperties": false, "required": [ "id" ], "properties": { - "id": { "type": "integer" }, - "name": { "type": "string" }, - "description": { "type": "string" }, - "url": { "type": "string" }, - "link": { "type": "string", "format": "uri" }, - "slug": { "type": "string" }, - "avatar_urls": { "type": "object", "additionalProperties": { "type": [ "string", "null" ], "format": "uri" } }, - "username": { "type": "string" }, - "email": { "type": [ "string", "null" ], "format": "email" }, - "first_name": { "type": "string" }, - "last_name": { "type": "string" }, - "nickname": { "type": "string" }, - "locale": { "type": "string" }, + "id": { "type": "integer" }, + "name": { "type": "string" }, + "description": { "type": "string" }, + "url": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "slug": { "type": "string" }, + "avatar_urls": { + "type": "object", + "additionalProperties": { "type": [ "string", "null" ], "format": "uri" } + }, + "username": { "type": "string" }, + "email": { "type": [ "string", "null" ], "format": "email" }, + "first_name": { "type": "string" }, + "last_name": { "type": "string" }, + "nickname": { "type": "string" }, + "locale": { "type": "string" }, "registered": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } }, - "roles": { "type": "array", "items": { "type": "string" } } + "roles": { "type": "array", "items": { "type": "string" } } } } }, @@ -915,26 +1135,39 @@ Output schema: "type": "object", "additionalProperties": false, "required": [ "total", "total_pages" ], - "properties": { "total": { "type": "integer" }, "total_pages": { "type": "integer" } } + "properties": { + "total": { "type": "integer" }, + "total_pages": { "type": "integer" } + } } } } ``` +
+ ### `core/user-create` -Example 1 input, an editor with chosen fields: +- Default `fields`: `id, name, link, slug, avatar_urls`. +- The input takes no `password`: WordPress generates one and emails the new user a link to set their own, the same email the Add User screen sends when "Send the new user an email about their account" is checked. The site admin gets the usual new user notice. -```json +**Example 1:** an editor with chosen fields + +```jsonc +// Input { - "data": { "username": "mcarter", "email": "m.carter@example.test", "name": "Maya Carter", "first_name": "Maya", "last_name": "Carter", "roles": [ "editor" ] }, + "data": { + "username": "mcarter", + "email": "m.carter@example.test", + "name": "Maya Carter", + "first_name": "Maya", + "last_name": "Carter", + "roles": [ "editor" ] + }, "fields": [ "name", "slug", "username", "email", "registered", "roles" ] } -``` - -Example 1 output: -```json +// Output { "id": 42, "name": "Maya Carter", @@ -946,15 +1179,13 @@ Example 1 output: } ``` -Example 2 input, the minimum input with the default fields: +**Example 2:** the minimum input with the default fields -```json +```jsonc +// Input { "data": { "username": "jdoe", "email": "j.doe@example.test" } } -``` - -Example 2 output: -```json +// Output { "id": 43, "name": "jdoe", @@ -968,15 +1199,13 @@ Example 2 output: } ``` -Example 3 input, a username that is taken: +**Example 3:** a username that is taken -```json +```jsonc +// Input { "data": { "username": "mcarter", "email": "maya.c@example.test" } } -``` - -Example 3 error: -```json +// Error { "code": "user_exists", "message": "Sorry, that username already exists!", @@ -984,7 +1213,8 @@ Example 3 error: } ``` -Input schema: +
+Input schema ```json { @@ -1007,7 +1237,15 @@ Input schema: "description": { "type": "string" }, "url": { "type": "string" }, "locale": { "type": "string", "enum": [ "", "en_US", "pt_PT" ] }, - "roles": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "administrator", "editor", "author", "contributor", "subscriber" ] } } + "roles": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "type": "string", + "enum": [ "administrator", "editor", "author", "contributor", "subscriber" ] + } + } } }, "fields": { @@ -1015,18 +1253,21 @@ Input schema: "uniqueItems": true, "items": { "type": "string", - "enum": [ "id", "name", "description", "url", "link", "slug", "avatar_urls", "username", "email", "first_name", "last_name", "nickname", "locale", "registered", "registered.site", "registered.gmt", "roles" ] + "enum": [ + "id", "name", "description", "url", "link", "slug", "avatar_urls", "username", "email", + "first_name", "last_name", "nickname", "locale", "registered", "registered.site", + "registered.gmt", "roles" + ] } } } } ``` -Default `fields`: `id, name, link, slug, avatar_urls`. - -The input takes no `password`: WordPress generates one and emails the new user a link to set their own, the same email the Add User screen sends when "Send the new user an email about their account" is checked. The site admin gets the usual new user notice. +
-Output schema: +
+Output schema ```json { @@ -1034,72 +1275,81 @@ Output schema: "additionalProperties": false, "required": [ "id" ], "properties": { - "id": { "type": "integer" }, - "name": { "type": "string" }, - "description": { "type": "string" }, - "url": { "type": "string" }, - "link": { "type": "string", "format": "uri" }, - "slug": { "type": "string" }, - "avatar_urls": { "type": "object", "additionalProperties": { "type": [ "string", "null" ], "format": "uri" } }, - "username": { "type": "string" }, - "email": { "type": [ "string", "null" ], "format": "email" }, - "first_name": { "type": "string" }, - "last_name": { "type": "string" }, - "nickname": { "type": "string" }, - "locale": { "type": "string" }, + "id": { "type": "integer" }, + "name": { "type": "string" }, + "description": { "type": "string" }, + "url": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "slug": { "type": "string" }, + "avatar_urls": { + "type": "object", + "additionalProperties": { "type": [ "string", "null" ], "format": "uri" } + }, + "username": { "type": "string" }, + "email": { "type": [ "string", "null" ], "format": "email" }, + "first_name": { "type": "string" }, + "last_name": { "type": "string" }, + "nickname": { "type": "string" }, + "locale": { "type": "string" }, "registered": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } - }, - "roles": { "type": "array", "items": { "type": "string" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } + }, + "roles": { "type": "array", "items": { "type": "string" } } } } ``` +
+ ### `core/user-update` -Example 1 input, a role change and a biography: +- Default `fields`: `id, name, link, slug, avatar_urls`. -```json +**Example 1:** a role change and a biography + +```jsonc +// Input { "where": { "id": 42 }, "data": { "roles": [ "author" ], "description": "Writes about hardware." }, "fields": [ "name", "description", "roles" ] } -``` - -Example 1 output: -```json +// Output { "id": 42, "name": "Maya Carter", "description": "Writes about hardware.", "roles": [ "author" ] } ``` -Example 2 input, a user changing their own email address: +**Example 2:** a user changing their own email address -```json +```jsonc +// Input { "where": { "id": 42 }, "data": { "email": "maya@example.test" }, "fields": [ "email" ] } -``` - -Example 2 output: -```json +// Output { "id": 42, "email": "maya@example.test" } ``` -Example 3 input, an editor trying to change roles, which needs `promote_user`: +**Example 3:** an editor trying to change roles, which needs `promote_user` -```json +```jsonc +// Input { "where": { "id": 43 }, "data": { "roles": [ "author" ] } } -``` -Example 3 error: - -```json -{ "code": "user_cannot_edit_roles", "message": "Sorry, you are not allowed to edit the roles of this user.", "data": { "status": 403 } } +// Error +{ + "code": "user_cannot_edit_roles", + "message": "Sorry, you are not allowed to edit the roles of this user.", + "data": { "status": 403 } +} ``` -Input schema: +
+Input schema ```json { @@ -1107,7 +1357,12 @@ Input schema: "additionalProperties": false, "required": [ "where", "data" ], "properties": { - "where": { "type": "object", "additionalProperties": false, "required": [ "id" ], "properties": { "id": { "type": "integer", "minimum": 1 } } }, + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { "id": { "type": "integer", "minimum": 1 } } + }, "data": { "type": "object", "additionalProperties": false, @@ -1122,7 +1377,15 @@ Input schema: "description": { "type": "string" }, "url": { "type": "string" }, "locale": { "type": "string", "enum": [ "", "en_US", "pt_PT" ] }, - "roles": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "administrator", "editor", "author", "contributor", "subscriber" ] } } + "roles": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "type": "string", + "enum": [ "administrator", "editor", "author", "contributor", "subscriber" ] + } + } } }, "fields": { @@ -1130,16 +1393,21 @@ Input schema: "uniqueItems": true, "items": { "type": "string", - "enum": [ "id", "name", "description", "url", "link", "slug", "avatar_urls", "username", "email", "first_name", "last_name", "nickname", "locale", "registered", "registered.site", "registered.gmt", "roles" ] + "enum": [ + "id", "name", "description", "url", "link", "slug", "avatar_urls", "username", "email", + "first_name", "last_name", "nickname", "locale", "registered", "registered.site", + "registered.gmt", "roles" + ] } } } } ``` -Default `fields`: `id, name, link, slug, avatar_urls`. +
-Output schema: +
+Output schema ```json { @@ -1147,56 +1415,64 @@ Output schema: "additionalProperties": false, "required": [ "id" ], "properties": { - "id": { "type": "integer" }, - "name": { "type": "string" }, - "description": { "type": "string" }, - "url": { "type": "string" }, - "link": { "type": "string", "format": "uri" }, - "slug": { "type": "string" }, - "avatar_urls": { "type": "object", "additionalProperties": { "type": [ "string", "null" ], "format": "uri" } }, - "username": { "type": "string" }, - "email": { "type": [ "string", "null" ], "format": "email" }, - "first_name": { "type": "string" }, - "last_name": { "type": "string" }, - "nickname": { "type": "string" }, - "locale": { "type": "string" }, + "id": { "type": "integer" }, + "name": { "type": "string" }, + "description": { "type": "string" }, + "url": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "slug": { "type": "string" }, + "avatar_urls": { + "type": "object", + "additionalProperties": { "type": [ "string", "null" ], "format": "uri" } + }, + "username": { "type": "string" }, + "email": { "type": [ "string", "null" ], "format": "email" }, + "first_name": { "type": "string" }, + "last_name": { "type": "string" }, + "nickname": { "type": "string" }, + "locale": { "type": "string" }, "registered": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } }, - "roles": { "type": "array", "items": { "type": "string" } } + "roles": { "type": "array", "items": { "type": "string" } } } } ``` -### `core/user-delete` +
-Example 1 input, deleting a user and handing their posts to user 7: +### `core/user-delete` -```json -{ "where": { "id": 42 }, "reassign": 7 } -``` +- `reassign` is required: the ID of the user who takes over the deleted user's content, or `false` to reassign nothing. With `false` the user's content is removed as well, as "Delete all content" does on the Users screen (posts and pages go to the trash); send it too when the user has no content. `true` is rejected. +- On multisite the user is removed from the current site instead, as "Remove" does on the site's Users screen: `outcome` is `removed` and the account stays in the network. There, `reassign: false` leaves the user's content in place; a user ID still reassigns it. -Over REST: +**Example 1:** deleting a user and handing their posts to user 7 -```http -DELETE /wp-json/wp-abilities/v1/abilities/core/user-delete/run?input[where][id]=42&input[reassign]=7 -``` +```jsonc +// Input +{ "where": { "id": 42 }, "reassign": 7 } -Example 1 output: +// Over REST +// DELETE /wp-json/wp-abilities/v1/abilities/core/user-delete/run?input[where][id]=42&input[reassign]=7 -```json +// Output { "outcome": "deleted" } ``` -Example 2 output, the same call on a multisite network: +**Example 2:** the same call on a multisite network -```json +```jsonc +// Output { "outcome": "removed" } ``` -Input schema: +
+Input schema ```json { @@ -1204,17 +1480,21 @@ Input schema: "additionalProperties": false, "required": [ "where", "reassign" ], "properties": { - "where": { "type": "object", "additionalProperties": false, "required": [ "id" ], "properties": { "id": { "type": "integer", "minimum": 1 } } }, + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { "id": { "type": "integer", "minimum": 1 } } + }, "reassign": { "type": [ "integer", "boolean" ], "minimum": 1 } } } ``` -`reassign` is required: the ID of the user who takes over the deleted user's content, or `false` to reassign nothing. With `false` the user's content is removed as well, as "Delete all content" does on the Users screen (posts and pages go to the trash); send it too when the user has no content. `true` is rejected. - -On multisite the user is removed from the current site instead, as "Remove" does on the site's Users screen: `outcome` is `removed` and the account stays in the network. There, `reassign: false` leaves the user's content in place; a user ID still reassigns it. +
-Output schema: +
+Output schema ```json { @@ -1225,22 +1505,26 @@ Output schema: } ``` +
+ ## Media abilities ### `core/media-query` -Example 1 input, the images attached to post 123 with chosen fields: +- Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. -```json +**Example 1:** the images attached to post 123 with chosen fields + +```jsonc +// Input { "where": { "media_type": [ "image" ], "post": 123 }, - "fields": [ "title.rendered", "alt_text", "source_url", "media_details.width", "media_details.height" ] + "fields": [ + "title.rendered", "alt_text", "source_url", "media_details.width", "media_details.height" + ] } -``` - -Example 1 output: -```json +// Output { "items": [ { @@ -1255,15 +1539,13 @@ Example 1 output: } ``` -Example 2 input, two attachments by ID with the default fields: +**Example 2:** two attachments by ID with the default fields -```json +```jsonc +// Input { "where": { "ids": [ 310, 311 ] } } -``` -Example 2 output: - -```json +// Output { "items": [ { @@ -1291,19 +1573,22 @@ Example 2 output: } ``` -Example 3 input, a subscriber asking for trashed attachments: +**Example 3:** a subscriber asking for trashed attachments -```json +```jsonc +// Input { "where": { "status": [ "trash" ] } } -``` - -Example 3 error: -```json -{ "code": "media_cannot_filter_by_status", "message": "Sorry, you are not allowed to filter media by this status.", "data": { "status": 403 } } +// Error +{ + "code": "media_cannot_filter_by_status", + "message": "Sorry, you are not allowed to filter media by this status.", + "data": { "status": 403 } +} ``` -Input schema: +
+Input schema ```json { @@ -1315,13 +1600,43 @@ Input schema: "type": "object", "additionalProperties": false, "properties": { - "ids": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "integer", "minimum": 1 } }, - "slugs": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, - "status": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "inherit", "private", "trash" ] } }, - "media_type": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "enum": [ "application", "audio", "image", "text", "video" ] } }, - "mime_type": { "type": "array", "uniqueItems": true, "minItems": 1, "items": { "type": "string", "minLength": 1 } }, - "post": { "type": "integer", "minimum": 0 }, - "author": { + "ids": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "maxItems": 100, + "items": { "type": "integer", "minimum": 1 } + }, + "slugs": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "maxItems": 100, + "items": { "type": "string", "minLength": 1 } + }, + "status": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { "type": "string", "enum": [ "inherit", "private", "trash" ] } + }, + "media_type": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "type": "string", + "enum": [ "application", "audio", "image", "text", "video" ] + } + }, + "mime_type": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { "type": "string", "minLength": 1 } + }, + "post": { "type": "integer", "minimum": 0 }, + "author": { "type": "object", "additionalProperties": false, "minProperties": 1, @@ -1351,15 +1666,19 @@ Input schema: "pagination": { "type": "object", "additionalProperties": false, - "properties": { "page": { "type": "integer", "minimum": 1 }, "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } } + "properties": { + "page": { "type": "integer", "minimum": 1 }, + "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } + } } } } ``` -Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. +
-Output schema: +
+Output schema ```json { @@ -1374,29 +1693,56 @@ Output schema: "additionalProperties": false, "required": [ "id" ], "properties": { - "id": { "type": "integer" }, - "status": { "type": "string" }, + "id": { "type": "integer" }, + "status": { "type": "string" }, "date": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } }, "modified": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } }, - "slug": { "type": "string" }, - "link": { "type": "string", "format": "uri" }, - "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "caption": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "description": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "alt_text": { "type": "string" }, - "media_type": { "type": "string" }, - "mime_type": { "type": "string" }, - "source_url": { "type": "string", "format": "uri" }, - "filename": { "type": "string" }, - "filesize": { "type": "integer" }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "caption": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "description": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "alt_text": { "type": "string" }, + "media_type": { "type": "string" }, + "mime_type": { "type": "string" }, + "source_url": { "type": "string", "format": "uri" }, + "filename": { "type": "string" }, + "filesize": { "type": "integer" }, "media_details": { "type": "object", "additionalProperties": false, @@ -1410,16 +1756,25 @@ Output schema: "type": "object", "additionalProperties": false, "required": [ "width", "height", "mime_type", "source_url" ], - "properties": { "width": { "type": "integer" }, "height": { "type": "integer" }, "mime_type": { "type": "string" }, "source_url": { "type": "string", "format": "uri" } } + "properties": { + "width": { "type": "integer" }, + "height": { "type": "integer" }, + "mime_type": { "type": "string" }, + "source_url": { "type": "string", "format": "uri" } + } } } } }, - "post": { "type": "integer" }, + "post": { "type": "integer" }, "author": { "type": "object", "additionalProperties": false, - "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + "properties": { + "id": { "type": "integer" }, + "name": { "type": [ "string", "null" ] }, + "slug": { "type": [ "string", "null" ] } + } } } } @@ -1428,17 +1783,26 @@ Output schema: "type": "object", "additionalProperties": false, "required": [ "total", "total_pages" ], - "properties": { "total": { "type": "integer" }, "total_pages": { "type": "integer" } } + "properties": { + "total": { "type": "integer" }, + "total_pages": { "type": "integer" } + } } } } ``` +
+ ### `core/media-upload` -Example 1 input, an image from a URL, attached to post 123: +- Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. +- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. -```json +**Example 1:** an image from a URL, attached to post 123 + +```jsonc +// Input { "data": { "file": { "url": "https://cdn.example.test/press/team-photo.jpg" }, @@ -1448,11 +1812,8 @@ Example 1 input, an image from a URL, attached to post 123: }, "fields": [ "title.rendered", "alt_text", "mime_type", "source_url", "media_details", "post" ] } -``` -Example 1 output: - -```json +// Output { "id": 310, "title": { "rendered": "Team photo" }, @@ -1463,29 +1824,42 @@ Example 1 output: "width": 2048, "height": 1365, "sizes": { - "thumbnail": { "width": 150, "height": 150, "mime_type": "image/jpeg", "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo-150x150.jpg" }, - "medium": { "width": 300, "height": 200, "mime_type": "image/jpeg", "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo-300x200.jpg" }, - "large": { "width": 1024, "height": 683, "mime_type": "image/jpeg", "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo-1024x683.jpg" } + "thumbnail": { + "width": 150, + "height": 150, + "mime_type": "image/jpeg", + "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo-150x150.jpg" + }, + "medium": { + "width": 300, + "height": 200, + "mime_type": "image/jpeg", + "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo-300x200.jpg" + }, + "large": { + "width": 1024, + "height": 683, + "mime_type": "image/jpeg", + "source_url": "https://example.test/wp-content/uploads/2026/10/team-photo-1024x683.jpg" + } } }, "post": 123 } ``` -Example 2 input, a PDF from inline bytes with the default fields: +**Example 2:** a PDF from inline bytes with the default fields -```json +```jsonc +// Input { "data": { "file": { "base64": "JVBERi0xLjcKJeLjz9MK…", "filename": "press-kit.pdf" }, "title": "Press kit" } } -``` -Example 2 output: - -```json +// Output { "id": 311, "status": "inherit", @@ -1498,23 +1872,25 @@ Example 2 output: } ``` -Example 3 input, the same PDF given as a URL: +**Example 3:** the same PDF given as a URL -```json +```jsonc +// Input { "data": { "file": { "url": "https://cdn.example.test/press/press-kit.pdf" } } } -``` - -Example 3 error: -```json +// Error { "code": "media_invalid_file", "message": "Only images can be uploaded from a URL.", - "data": { "status": 400, "params": { "data[file][url]": "Only images can be uploaded from a URL." } } + "data": { + "status": 400, + "params": { "data[file][url]": "Only images can be uploaded from a URL." } + } } ``` -Input schema: +
+Input schema ```json { @@ -1529,12 +1905,20 @@ Input schema: "properties": { "file": { "anyOf": [ - { "type": "object", "additionalProperties": false, "required": [ "url" ], "properties": { "url": { "type": "string", "format": "uri" } } }, + { + "type": "object", + "additionalProperties": false, + "required": [ "url" ], + "properties": { "url": { "type": "string", "format": "uri" } } + }, { "type": "object", "additionalProperties": false, "required": [ "base64", "filename" ], - "properties": { "base64": { "type": "string", "minLength": 1 }, "filename": { "type": "string", "minLength": 1 } } + "properties": { + "base64": { "type": "string", "minLength": 1 }, + "filename": { "type": "string", "minLength": 1 } + } } ] }, @@ -1547,10 +1931,13 @@ Input schema: "type": "object", "additionalProperties": false, "minProperties": 1, - "properties": { "site": { "type": "string", "format": "date-time" }, "gmt": { "type": "string", "format": "date-time" } } + "properties": { + "site": { "type": "string", "format": "date-time" }, + "gmt": { "type": "string", "format": "date-time" } + } }, - "author": { "type": "integer", "minimum": 1 }, - "post": { "type": "integer", "minimum": 1 } + "author": { "type": "integer", "minimum": 1 }, + "post": { "type": "integer", "minimum": 1 } } }, "fields": { @@ -1573,11 +1960,10 @@ Input schema: } ``` -Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. - -`data.date` takes `site`, `gmt` or both; `site` wins when both are sent. +
-Output schema: +
+Output schema ```json { @@ -1585,29 +1971,56 @@ Output schema: "additionalProperties": false, "required": [ "id" ], "properties": { - "id": { "type": "integer" }, - "status": { "type": "string" }, + "id": { "type": "integer" }, + "status": { "type": "string" }, "date": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } }, "modified": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } }, - "slug": { "type": "string" }, - "link": { "type": "string", "format": "uri" }, - "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "caption": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "description": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "alt_text": { "type": "string" }, - "media_type": { "type": "string" }, - "mime_type": { "type": "string" }, - "source_url": { "type": "string", "format": "uri" }, - "filename": { "type": "string" }, - "filesize": { "type": "integer" }, + "caption": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "description": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "alt_text": { "type": "string" }, + "media_type": { "type": "string" }, + "mime_type": { "type": "string" }, + "source_url": { "type": "string", "format": "uri" }, + "filename": { "type": "string" }, + "filesize": { "type": "integer" }, "media_details": { "type": "object", "additionalProperties": false, @@ -1621,36 +2034,48 @@ Output schema: "type": "object", "additionalProperties": false, "required": [ "width", "height", "mime_type", "source_url" ], - "properties": { "width": { "type": "integer" }, "height": { "type": "integer" }, "mime_type": { "type": "string" }, "source_url": { "type": "string", "format": "uri" } } + "properties": { + "width": { "type": "integer" }, + "height": { "type": "integer" }, + "mime_type": { "type": "string" }, + "source_url": { "type": "string", "format": "uri" } + } } } } }, - "post": { "type": "integer" }, + "post": { "type": "integer" }, "author": { "type": "object", "additionalProperties": false, - "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + "properties": { + "id": { "type": "integer" }, + "name": { "type": [ "string", "null" ] }, + "slug": { "type": [ "string", "null" ] } + } } } } ``` +
+ ### `core/media-update` -Example 1 input, a caption and a new alt text: +- Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. +- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. -```json +**Example 1:** a caption and a new alt text + +```jsonc +// Input { "where": { "id": 310 }, "data": { "caption": "October 2026", "alt_text": "The team on the office roof, October 2026" }, "fields": [ "caption", "alt_text" ] } -``` -Example 1 output: - -```json +// Output { "id": 310, "caption": { "raw": "October 2026", "rendered": "

October 2026

\n" }, @@ -1658,31 +2083,32 @@ Example 1 output: } ``` -Example 2 input, detaching the press kit from its post: +**Example 2:** detaching the press kit from its post -```json +```jsonc +// Input { "where": { "id": 311 }, "data": { "post": 0 }, "fields": [ "post" ] } -``` -Example 2 output: - -```json +// Output { "id": 311, "post": 0 } ``` -Example 3 input, attaching it to a post the user cannot edit: +**Example 3:** attaching it to a post the user cannot edit -```json +```jsonc +// Input { "where": { "id": 311 }, "data": { "post": 7 } } -``` - -Example 3 error: -```json -{ "code": "media_cannot_attach", "message": "Sorry, you are not allowed to attach media to this post.", "data": { "status": 403 } } +// Error +{ + "code": "media_cannot_attach", + "message": "Sorry, you are not allowed to attach media to this post.", + "data": { "status": 403 } +} ``` -Input schema: +
+Input schema ```json { @@ -1690,7 +2116,12 @@ Input schema: "additionalProperties": false, "required": [ "where", "data" ], "properties": { - "where": { "type": "object", "additionalProperties": false, "required": [ "id" ], "properties": { "id": { "type": "integer", "minimum": 1 } } }, + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { "id": { "type": "integer", "minimum": 1 } } + }, "data": { "type": "object", "additionalProperties": false, @@ -1705,10 +2136,13 @@ Input schema: "type": "object", "additionalProperties": false, "minProperties": 1, - "properties": { "site": { "type": "string", "format": "date-time" }, "gmt": { "type": "string", "format": "date-time" } } + "properties": { + "site": { "type": "string", "format": "date-time" }, + "gmt": { "type": "string", "format": "date-time" } + } }, - "author": { "type": "integer", "minimum": 1 }, - "post": { "type": "integer", "minimum": 0 } + "author": { "type": "integer", "minimum": 1 }, + "post": { "type": "integer", "minimum": 0 } } }, "fields": { @@ -1731,11 +2165,10 @@ Input schema: } ``` -Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. - -`data.date` takes `site`, `gmt` or both; `site` wins when both are sent. +
-Output schema: +
+Output schema ```json { @@ -1743,29 +2176,56 @@ Output schema: "additionalProperties": false, "required": [ "id" ], "properties": { - "id": { "type": "integer" }, - "status": { "type": "string" }, + "id": { "type": "integer" }, + "status": { "type": "string" }, "date": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } }, "modified": { "type": "object", "additionalProperties": false, - "properties": { "site": { "type": [ "string", "null" ], "format": "date-time" }, "gmt": { "type": [ "string", "null" ], "format": "date-time" } } + "properties": { + "site": { "type": [ "string", "null" ], "format": "date-time" }, + "gmt": { "type": [ "string", "null" ], "format": "date-time" } + } + }, + "slug": { "type": "string" }, + "link": { "type": "string", "format": "uri" }, + "title": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } }, - "slug": { "type": "string" }, - "link": { "type": "string", "format": "uri" }, - "title": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "caption": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "description": { "type": "object", "additionalProperties": false, "properties": { "raw": { "type": "string" }, "rendered": { "type": "string" } } }, - "alt_text": { "type": "string" }, - "media_type": { "type": "string" }, - "mime_type": { "type": "string" }, - "source_url": { "type": "string", "format": "uri" }, - "filename": { "type": "string" }, - "filesize": { "type": "integer" }, + "caption": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "description": { + "type": "object", + "additionalProperties": false, + "properties": { + "raw": { "type": "string" }, + "rendered": { "type": "string" } + } + }, + "alt_text": { "type": "string" }, + "media_type": { "type": "string" }, + "mime_type": { "type": "string" }, + "source_url": { "type": "string", "format": "uri" }, + "filename": { "type": "string" }, + "filesize": { "type": "integer" }, "media_details": { "type": "object", "additionalProperties": false, @@ -1779,54 +2239,65 @@ Output schema: "type": "object", "additionalProperties": false, "required": [ "width", "height", "mime_type", "source_url" ], - "properties": { "width": { "type": "integer" }, "height": { "type": "integer" }, "mime_type": { "type": "string" }, "source_url": { "type": "string", "format": "uri" } } + "properties": { + "width": { "type": "integer" }, + "height": { "type": "integer" }, + "mime_type": { "type": "string" }, + "source_url": { "type": "string", "format": "uri" } + } } } } }, - "post": { "type": "integer" }, + "post": { "type": "integer" }, "author": { "type": "object", "additionalProperties": false, - "properties": { "id": { "type": "integer" }, "name": { "type": [ "string", "null" ] }, "slug": { "type": [ "string", "null" ] } } + "properties": { + "id": { "type": "integer" }, + "name": { "type": [ "string", "null" ] }, + "slug": { "type": [ "string", "null" ] } + } } } } ``` -### `core/media-delete` +
-Example 1 input, a permanent deletion: +### `core/media-delete` -```json -{ "where": { "id": 310 }, "permanent": true } -``` +- When `MEDIA_TRASH` is off, which is the default, `permanent: true` is required: an attachment cannot be trashed there, only deleted. -Over REST: +**Example 1:** a permanent deletion -```http -DELETE /wp-json/wp-abilities/v1/abilities/core/media-delete/run?input[where][id]=310&input[permanent]=true -``` +```jsonc +// Input +{ "where": { "id": 310 }, "permanent": true } -Example 1 output: +// Over REST +// DELETE /wp-json/wp-abilities/v1/abilities/core/media-delete/run?input[where][id]=310&input[permanent]=true -```json +// Output { "outcome": "deleted" } ``` -Example 2 input, the same call without `permanent` on a site where the media trash is off: +**Example 2:** the same call without `permanent` on a site where the media trash is off -```json +```jsonc +// Input { "where": { "id": 310 } } -``` - -Example 2 error: -```json -{ "code": "media_trash_not_supported", "message": "The attachment does not support trashing. Set \"permanent\" to delete it.", "data": { "status": 501 } } +// Error +{ + "code": "media_trash_not_supported", + "message": "The attachment does not support trashing. Set \"permanent\" to delete it.", + "data": { "status": 501 } +} ``` -Input schema: +
+Input schema ```json { @@ -1834,15 +2305,21 @@ Input schema: "additionalProperties": false, "required": [ "where" ], "properties": { - "where": { "type": "object", "additionalProperties": false, "required": [ "id" ], "properties": { "id": { "type": "integer", "minimum": 1 } } }, + "where": { + "type": "object", + "additionalProperties": false, + "required": [ "id" ], + "properties": { "id": { "type": "integer", "minimum": 1 } } + }, "permanent": { "type": "boolean" } } } ``` -When `MEDIA_TRASH` is off, which is the default, `permanent: true` is required: an attachment cannot be trashed there, only deleted. +
-Output schema: +
+Output schema ```json { @@ -1853,23 +2330,25 @@ Output schema: } ``` +
+ ## Term abilities ### `core/terms-query` -Example 1 input, the top-level categories, two per page: +- Default `fields`: `id, taxonomy, name, slug, link`. -```json +**Example 1:** the top-level categories, two per page + +```jsonc +// Input { "where": { "taxonomy": "category", "parent": 0 }, "fields": [ "name", "slug", "count" ], "pagination": { "per_page": 2 } } -``` -Example 1 output: - -```json +// Output { "items": [ { "id": 3, "name": "News", "slug": "news", "count": 12 }, @@ -1879,40 +2358,46 @@ Example 1 output: } ``` -Example 2 input, the tags of post 123 with the default fields: +**Example 2:** the tags of post 123 with the default fields -```json +```jsonc +// Input { "where": { "taxonomy": "post_tag", "post": 123 } } -``` - -Example 2 output: -```json +// Output { "items": [ - { "id": 15, "taxonomy": "post_tag", "name": "beta", "slug": "beta", "link": "https://example.test/tag/beta/" } + { + "id": 15, + "taxonomy": "post_tag", + "name": "beta", + "slug": "beta", + "link": "https://example.test/tag/beta/" + } ], "pagination": { "total": 1, "total_pages": 1 } } ``` -Example 3 input, `parent` on a flat taxonomy: +**Example 3:** `parent` on a flat taxonomy -```json +```jsonc +// Input { "where": { "taxonomy": "post_tag", "parent": 0 } } -``` -Example 3 error: - -```json +// Error { "code": "terms_invalid_filter", "message": "The \"post_tag\" taxonomy is not hierarchical.", - "data": { "status": 400, "params": { "where[parent]": "The \"post_tag\" taxonomy is not hierarchical." } } + "data": { + "status": 400, + "params": { "where[parent]": "The \"post_tag\" taxonomy is not hierarchical." } + } } ``` -Input schema: +
+Input schema ```json { @@ -1925,27 +2410,50 @@ Input schema: "additionalProperties": false, "required": [ "taxonomy" ], "properties": { - "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, - "ids": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "integer", "minimum": 1 } }, - "slugs": { "type": "array", "uniqueItems": true, "minItems": 1, "maxItems": 100, "items": { "type": "string", "minLength": 1 } }, + "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, + "ids": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "maxItems": 100, + "items": { "type": "integer", "minimum": 1 } + }, + "slugs": { + "type": "array", + "uniqueItems": true, + "minItems": 1, + "maxItems": 100, + "items": { "type": "string", "minLength": 1 } + }, "parent": { "type": "integer", "minimum": 0 }, "post": { "type": "integer", "minimum": 1 }, "hide_empty": { "type": "boolean" } } }, - "fields": { "type": "array", "uniqueItems": true, "items": { "type": "string", "enum": [ "id", "taxonomy", "name", "slug", "description", "parent", "count", "link" ] } }, + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ "id", "taxonomy", "name", "slug", "description", "parent", "count", "link" ] + } + }, "pagination": { "type": "object", "additionalProperties": false, - "properties": { "page": { "type": "integer", "minimum": 1 }, "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } } + "properties": { + "page": { "type": "integer", "minimum": 1 }, + "per_page": { "type": "integer", "minimum": 1, "maximum": 100 } + } } } } ``` -Default `fields`: `id, taxonomy, name, slug, link`. +
-Output schema: +
+Output schema ```json { @@ -1975,26 +2483,31 @@ Output schema: "type": "object", "additionalProperties": false, "required": [ "total", "total_pages" ], - "properties": { "total": { "type": "integer" }, "total_pages": { "type": "integer" } } + "properties": { + "total": { "type": "integer" }, + "total_pages": { "type": "integer" } + } } } } ``` +
+ ### `core/term-create` -Example 1 input, a child category under News: +- Default `fields`: `id, taxonomy, name, slug, link`. -```json +**Example 1:** a child category under News + +```jsonc +// Input { "data": { "taxonomy": "category", "name": "Product updates", "parent": 3 }, "fields": [ "name", "slug", "parent", "link" ] } -``` - -Example 1 output: -```json +// Output { "id": 9, "name": "Product updates", @@ -2004,21 +2517,26 @@ Example 1 output: } ``` -Example 2 input, a tag with the default fields: +**Example 2:** a tag with the default fields -```json +```jsonc +// Input { "data": { "taxonomy": "post_tag", "name": "beta" } } -``` -Example 2 output: - -```json -{ "id": 15, "taxonomy": "post_tag", "name": "beta", "slug": "beta", "link": "https://example.test/tag/beta/" } +// Output +{ + "id": 15, + "taxonomy": "post_tag", + "name": "beta", + "slug": "beta", + "link": "https://example.test/tag/beta/" +} ``` -Example 3 error, the first call repeated: +**Example 3:** the first call repeated -```json +```jsonc +// Error { "code": "term_exists", "message": "A term with the name provided already exists with this parent.", @@ -2026,7 +2544,8 @@ Example 3 error, the first call repeated: } ``` -Input schema: +
+Input schema ```json { @@ -2046,14 +2565,22 @@ Input schema: "parent": { "type": "integer", "minimum": 0 } } }, - "fields": { "type": "array", "uniqueItems": true, "items": { "type": "string", "enum": [ "id", "taxonomy", "name", "slug", "description", "parent", "count", "link" ] } } + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ "id", "taxonomy", "name", "slug", "description", "parent", "count", "link" ] + } + } } } ``` -Default `fields`: `id, taxonomy, name, slug, link`. +
-Output schema: +
+Output schema ```json { @@ -2073,49 +2600,61 @@ Output schema: } ``` +
+ ### `core/term-update` -Example 1 input, a description: +- Default `fields`: `id, taxonomy, name, slug, link`. -```json +**Example 1:** a description + +```jsonc +// Input { "where": { "taxonomy": "category", "id": 9 }, "data": { "description": "Release notes and roadmap updates." }, "fields": [ "name", "description" ] } -``` - -Example 1 output: -```json +// Output { "id": 9, "name": "Product updates", "description": "Release notes and roadmap updates." } ``` -Example 2 input, moving the category to the top level, which changes its link: +**Example 2:** moving the category to the top level, which changes its link -```json -{ "where": { "taxonomy": "category", "id": 9 }, "data": { "parent": 0 }, "fields": [ "name", "parent", "link" ] } -``` - -Example 2 output: +```jsonc +// Input +{ + "where": { "taxonomy": "category", "id": 9 }, + "data": { "parent": 0 }, + "fields": [ "name", "parent", "link" ] +} -```json -{ "id": 9, "name": "Product updates", "parent": 0, "link": "https://example.test/category/product-updates/" } +// Output +{ + "id": 9, + "name": "Product updates", + "parent": 0, + "link": "https://example.test/category/product-updates/" +} ``` -Example 3 input, a term that is not in the taxonomy named in `where`: +**Example 3:** a term that is not in the taxonomy named in `where` -```json +```jsonc +// Input { "where": { "taxonomy": "post_tag", "id": 9 }, "data": { "name": "Product updates" } } -``` - -Example 3 error: -```json -{ "code": "term_not_found", "message": "The requested term was not found.", "data": { "status": 404 } } +// Error +{ + "code": "term_not_found", + "message": "The requested term was not found.", + "data": { "status": 404 } +} ``` -Input schema: +
+Input schema ```json { @@ -2127,7 +2666,10 @@ Input schema: "type": "object", "additionalProperties": false, "required": [ "taxonomy", "id" ], - "properties": { "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, "id": { "type": "integer", "minimum": 1 } } + "properties": { + "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, + "id": { "type": "integer", "minimum": 1 } + } }, "data": { "type": "object", @@ -2140,14 +2682,22 @@ Input schema: "parent": { "type": "integer", "minimum": 0 } } }, - "fields": { "type": "array", "uniqueItems": true, "items": { "type": "string", "enum": [ "id", "taxonomy", "name", "slug", "description", "parent", "count", "link" ] } } + "fields": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ "id", "taxonomy", "name", "slug", "description", "parent", "count", "link" ] + } + } } } ``` -Default `fields`: `id, taxonomy, name, slug, link`. +
-Output schema: +
+Output schema ```json { @@ -2167,39 +2717,39 @@ Output schema: } ``` +
+ ### `core/term-delete` -Example 1 input, deleting a tag: +**Example 1:** deleting a tag -```json +```jsonc +// Input { "where": { "taxonomy": "post_tag", "id": 15 } } -``` -Over REST: +// Over REST +// DELETE /wp-json/wp-abilities/v1/abilities/core/term-delete/run?input[where][taxonomy]=post_tag&input[where][id]=15 -```http -DELETE /wp-json/wp-abilities/v1/abilities/core/term-delete/run?input[where][taxonomy]=post_tag&input[where][id]=15 -``` - -Example 1 output: - -```json +// Output { "outcome": "deleted" } ``` -Example 2 input, the default category is refused: +**Example 2:** the default category is refused -```json +```jsonc +// Input { "where": { "taxonomy": "category", "id": 1 } } -``` - -Example 2 error: -```json -{ "code": "term_is_default", "message": "The default category cannot be deleted.", "data": { "status": 400 } } +// Error +{ + "code": "term_is_default", + "message": "The default category cannot be deleted.", + "data": { "status": 400 } +} ``` -Input schema: +
+Input schema ```json { @@ -2211,13 +2761,19 @@ Input schema: "type": "object", "additionalProperties": false, "required": [ "taxonomy", "id" ], - "properties": { "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, "id": { "type": "integer", "minimum": 1 } } + "properties": { + "taxonomy": { "type": "string", "enum": [ "category", "post_tag" ] }, + "id": { "type": "integer", "minimum": 1 } + } } } } ``` -Output schema: +
+ +
+Output schema ```json { @@ -2227,3 +2783,5 @@ Output schema: "properties": { "outcome": { "type": "string" } } } ``` + +
From a14418fbc41c7ad814ee4c5d699307b13ad503c9 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 17 Nov 2026 21:40:50 +0000 Subject: [PATCH 03/13] CORE-SHAPE.md: refine the user write abilities - core/user-delete is not idempotent: once the user is deleted or removed, the same call answers 404. Its REST method is POST, with the input in the body. - core/user-create and core/user-update limit email to 100 characters and name to 250, the sizes of their database columns. - core/user-create says which role the user gets when roles is left out. - core/user-delete says what happens to each kind of content when the user is deleted with or without reassigning it. --- CORE-SHAPE.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index b5e7852..2d1eff2 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -13,7 +13,7 @@ This document is the source of truth for the shape of the core abilities: their | [`core/users-query`](#coreusers-query) | Landed, [`39981fd0fe`](https://github.com/WordPress/wordpress-develop/commit/39981fd0fef) | user | `true` | `false` | `true` | `GET` | | [`core/user-create`](#coreuser-create) | Proposed | user | `false` | `false` | `false` | `POST` | | [`core/user-update`](#coreuser-update) | Proposed | user | `false` | `false` | `true` | `POST` | -| [`core/user-delete`](#coreuser-delete) | Proposed | user | `false` | `true` | `true` | `DELETE` | +| [`core/user-delete`](#coreuser-delete) | Proposed | user | `false` | `true` | `false` | `POST` | | [`core/media-query`](#coremedia-query) | Proposed | content | `true` | `false` | `true` | `GET` | | [`core/media-upload`](#coremedia-upload) | Proposed | content | `false` | `false` | `false` | `POST` | | [`core/media-update`](#coremedia-update) | Proposed | content | `false` | `false` | `true` | `POST` | @@ -1150,6 +1150,8 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th - Default `fields`: `id, name, link, slug, avatar_urls`. - The input takes no `password`: WordPress generates one and emails the new user a link to set their own, the same email the Add User screen sends when "Send the new user an email about their account" is checked. The site admin gets the usual new user notice. +- `roles` is optional. Without it the new user gets the site's default role, the "New User Default Role" setting. On multisite there is no default: the user becomes a member of the current site with no role. +- `email` takes up to 100 characters and `name` up to 250, the sizes of their database columns. **Example 1:** an editor with chosen fields @@ -1228,8 +1230,8 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "required": [ "username", "email" ], "properties": { "username": { "type": "string", "minLength": 1 }, - "email": { "type": "string", "format": "email" }, - "name": { "type": "string", "minLength": 1 }, + "email": { "type": "string", "format": "email", "maxLength": 100 }, + "name": { "type": "string", "minLength": 1, "maxLength": 250 }, "first_name": { "type": "string" }, "last_name": { "type": "string" }, "nickname": { "type": "string", "minLength": 1 }, @@ -1368,8 +1370,8 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "additionalProperties": false, "minProperties": 1, "properties": { - "email": { "type": "string", "format": "email" }, - "name": { "type": "string", "minLength": 1 }, + "email": { "type": "string", "format": "email", "maxLength": 100 }, + "name": { "type": "string", "minLength": 1, "maxLength": 250 }, "first_name": { "type": "string" }, "last_name": { "type": "string" }, "nickname": { "type": "string", "minLength": 1 }, @@ -1448,8 +1450,15 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/user-delete` -- `reassign` is required: the ID of the user who takes over the deleted user's content, or `false` to reassign nothing. With `false` the user's content is removed as well, as "Delete all content" does on the Users screen (posts and pages go to the trash); send it too when the user has no content. `true` is rejected. +- `reassign` is required: the ID of the user who takes over the deleted user's content, or `false` to reassign nothing. Send `false` too when the user has no content. `true` is rejected. +- With a user ID, every post of the deleted user, of any post type, moves to that user, and so do their links. +- With `false`, the user's content is deleted with the account, as "Delete all content" does on the Users screen: + - Posts and pages go to the trash. One that is already in the trash is deleted permanently, and so are all of them on a site with the trash turned off. + - Media and posts of other post types are deleted permanently. Media goes to the trash only where `MEDIA_TRASH` is on. + - Links are deleted. + - Posts of a post type that is not deleted with its author, such as patterns, stay as they are. - On multisite the user is removed from the current site instead, as "Remove" does on the site's Users screen: `outcome` is `removed` and the account stays in the network. There, `reassign: false` leaves the user's content in place; a user ID still reassigns it. +- `idempotent` is `false`: once the user is deleted or removed, the same call answers `user_not_found` with status 404. So the REST method is `POST`, with the input in the body. **Example 1:** deleting a user and handing their posts to user 7 @@ -1458,7 +1467,8 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th { "where": { "id": 42 }, "reassign": 7 } // Over REST -// DELETE /wp-json/wp-abilities/v1/abilities/core/user-delete/run?input[where][id]=42&input[reassign]=7 +// POST /wp-json/wp-abilities/v1/abilities/core/user-delete/run +{ "input": { "where": { "id": 42 }, "reassign": 7 } } // Output { "outcome": "deleted" } From b1f10db33c81e1dd69a37e5077e0cb541032b718 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 24 Nov 2026 16:31:44 +0000 Subject: [PATCH 04/13] CORE-SHAPE.md: mark core/settings-update destructive and not idempotent - core/settings-update is destructive: a null value deletes the stored value of a setting. - It is not idempotent: repeating a null value can fail, since a setting without a default has no stored value left to delete. - Its REST method stays POST. --- CORE-SHAPE.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index 2d1eff2..2e7446f 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -9,7 +9,7 @@ This document is the source of truth for the shape of the core abilities: their | [`core/content-update`](#corecontent-update) | Proposed | content | `false` | `false` | `true` | `POST` | | [`core/content-delete`](#corecontent-delete) | Proposed | content | `false` | `true` | `true` | `DELETE` | | [`core/settings-get`](#coresettings-get) | Landed, [`b6512b1e8c`](https://github.com/WordPress/wordpress-develop/commit/b6512b1e8ca) | site | `true` | `false` | `true` | `GET` | -| [`core/settings-update`](#coresettings-update) | Proposed | site | `false` | `false` | `true` | `POST` | +| [`core/settings-update`](#coresettings-update) | Proposed | site | `false` | `true` | `false` | `POST` | | [`core/users-query`](#coreusers-query) | Landed, [`39981fd0fe`](https://github.com/WordPress/wordpress-develop/commit/39981fd0fef) | user | `true` | `false` | `true` | `GET` | | [`core/user-create`](#coreuser-create) | Proposed | user | `false` | `false` | `false` | `POST` | | [`core/user-update`](#coreuser-update) | Proposed | user | `false` | `false` | `true` | `POST` | @@ -832,6 +832,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/settings-update` +- A `null` value deletes the stored value of a setting, which then reads as its default when it has one. This is why the ability is `destructive`. +- The ability is not `idempotent`: repeating a `null` value can fail. For a setting without a default, the second call finds no stored value left to delete. + **Example 1:** a title, a reading option and a deleted option ```jsonc From 8aa45758a9a90a2894e1fbad19eff376f9d26fe9 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 24 Nov 2026 17:33:55 +0000 Subject: [PATCH 05/13] Core shape: Document the `settings_invalid_value` error of `core/settings-update`. A value that matches the schema but that the setting cannot use is refused, and the error data names the setting under `params`. --- CORE-SHAPE.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index 2e7446f..af0cd0f 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -834,6 +834,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th - A `null` value deletes the stored value of a setting, which then reads as its default when it has one. This is why the ability is `destructive`. - The ability is not `idempotent`: repeating a `null` value can fail. For a setting without a default, the second call finds no stored value left to delete. +- A value that matches the schema but that the setting cannot use is refused with `settings_invalid_value`, and nothing is saved. This covers an unknown `timezone`, a `language` that is not installed, an unknown `default_post_format`, a page setting that is not 0 or the ID of a page, and a `default_category` that is not the ID of a category. **Example 1:** a title, a reading option and a deleted option @@ -873,6 +874,20 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th } ``` +**Example 4:** a front page that does not exist + +```jsonc +// Input +{ "data": { "show_on_front": "page", "page_on_front": 999999 } } + +// Error +{ + "code": "settings_invalid_value", + "message": "Invalid page ID.", + "data": { "status": 400, "params": { "data[page_on_front]": "Invalid page ID." } } +} +``` +
Input schema From a5b427286388f32610e3c4142e6255b039b99c2f Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 24 Nov 2026 18:40:03 +0000 Subject: [PATCH 06/13] Core shape: Keep the site address and email read-only in `core/settings-update`. The site address (`url`) and the administration email address (`email`) are left out of the `core/settings-update` input, and stay readable with `core/settings-get`. When several values cannot be used, the `settings_invalid_value` error data maps each refused setting to its message under `params`, as the new Example 5 shows. --- CORE-SHAPE.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index af0cd0f..c242c68 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -834,7 +834,8 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th - A `null` value deletes the stored value of a setting, which then reads as its default when it has one. This is why the ability is `destructive`. - The ability is not `idempotent`: repeating a `null` value can fail. For a setting without a default, the second call finds no stored value left to delete. -- A value that matches the schema but that the setting cannot use is refused with `settings_invalid_value`, and nothing is saved. This covers an unknown `timezone`, a `language` that is not installed, an unknown `default_post_format`, a page setting that is not 0 or the ID of a page, and a `default_category` that is not the ID of a category. +- A value that matches the schema but that the setting cannot use is refused with `settings_invalid_value`, and nothing is saved. This covers an unknown `timezone`, a `language` that is not installed, an unknown `default_post_format`, a page setting that is not 0 or the ID of a page, and a `default_category` that is not the ID of a category. The error data maps each refused setting to its message under `params`. +- The site address (`url`) and the administration email address (`email`) are read-only: `core/settings-get` returns them, but they are left out of the input, under whatever name a plugin exposes them. Settings > General only changes the administration email address after the new address confirms it. **Example 1:** a title, a reading option and a deleted option @@ -888,6 +889,26 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th } ``` +**Example 5:** several values the settings cannot use + +```jsonc +// Input +{ "data": { "timezone": "Mars/Olympus", "language": "xx_XX" } } + +// Error +{ + "code": "settings_invalid_value", + "message": "Invalid parameter(s): data[timezone], data[language]", + "data": { + "status": 400, + "params": { + "data[timezone]": "The timezone you have entered is not valid. Please select a valid timezone.", + "data[language]": "The language is not installed." + } + } +} +``` +
Input schema @@ -904,8 +925,6 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "properties": { "title": { "type": [ "string", "null" ] }, "description": { "type": [ "string", "null" ] }, - "url": { "type": [ "string", "null" ], "format": "uri" }, - "email": { "type": [ "string", "null" ], "format": "email" }, "timezone": { "type": [ "string", "null" ] }, "date_format": { "type": [ "string", "null" ] }, "time_format": { "type": [ "string", "null" ] }, @@ -942,8 +961,6 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "properties": { "title": { "type": "string" }, "description": { "type": "string" }, - "url": { "type": "string", "format": "uri" }, - "email": { "type": "string", "format": "email" }, "timezone": { "type": "string" }, "date_format": { "type": "string" }, "time_format": { "type": "string" }, From 5c57693481f963736b34e082288a7e78befd073a Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 24 Nov 2026 18:53:13 +0000 Subject: [PATCH 07/13] Core shape: Store the default for a null value in `core/settings-update`. A null value now resets a setting to its default and stores it, so requests that do not register the setting read it too. A setting without a default still has its stored value deleted, which keeps the ability `destructive`. --- CORE-SHAPE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index c242c68..ea14812 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -832,12 +832,12 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/settings-update` -- A `null` value deletes the stored value of a setting, which then reads as its default when it has one. This is why the ability is `destructive`. +- A `null` value resets a setting to its default, and stores the default so requests that do not register the setting read it too. A setting without a default has its stored value deleted, which is why the ability is `destructive`. - The ability is not `idempotent`: repeating a `null` value can fail. For a setting without a default, the second call finds no stored value left to delete. - A value that matches the schema but that the setting cannot use is refused with `settings_invalid_value`, and nothing is saved. This covers an unknown `timezone`, a `language` that is not installed, an unknown `default_post_format`, a page setting that is not 0 or the ID of a page, and a `default_category` that is not the ID of a category. The error data maps each refused setting to its message under `params`. - The site address (`url`) and the administration email address (`email`) are read-only: `core/settings-get` returns them, but they are left out of the input, under whatever name a plugin exposes them. Settings > General only changes the administration email address after the new address confirms it. -**Example 1:** a title, a reading option and a deleted option +**Example 1:** a title, a reading option and an option reset to its default ```jsonc // Input From f5a9777bcad6b59470f998411ff728c7ca991b80 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 24 Nov 2026 19:54:35 +0000 Subject: [PATCH 08/13] Core shape: Reset a setting without a stored value in `core/settings-update`. A null value for a setting with a default always stores the default, and a null value for a setting without a default and without a stored value changes nothing. Only a setting without a default whose stored value does not match its schema still refuses null, so Example 3 now uses `start_of_week`. The note on `idempotent` gives the new reason the ability is not marked idempotent. --- CORE-SHAPE.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index ea14812..6624a4c 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -832,8 +832,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/settings-update` -- A `null` value resets a setting to its default, and stores the default so requests that do not register the setting read it too. A setting without a default has its stored value deleted, which is why the ability is `destructive`. -- The ability is not `idempotent`: repeating a `null` value can fail. For a setting without a default, the second call finds no stored value left to delete. +- A `null` value resets a setting to its default, and stores the default so requests that do not register the setting read it too. A setting without a default has its stored value deleted, which is why the ability is `destructive`, and a `null` value for one without a stored value changes nothing. +- A `null` value for a setting without a default is refused with `settings_invalid_stored_value` while its stored value does not match its schema: `core/settings-get` leaves that value out, so the caller cannot see what would be deleted. A setting with a default always takes its default. +- The ability is not `idempotent`, although repeating a call has no further effect: an ability that is both `destructive` and `idempotent` runs with the `DELETE` method, and this ability updates settings. - A value that matches the schema but that the setting cannot use is refused with `settings_invalid_value`, and nothing is saved. This covers an unknown `timezone`, a `language` that is not installed, an unknown `default_post_format`, a page setting that is not 0 or the ID of a page, and a `default_category` that is not the ID of a category. The error data maps each refused setting to its message under `params`. - The site address (`url`) and the administration email address (`email`) are read-only: `core/settings-get` returns them, but they are left out of the input, under whatever name a plugin exposes them. Settings > General only changes the administration email address after the new address confirms it. @@ -861,16 +862,16 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th { "default_comment_status": "closed", "default_ping_status": "closed" } ``` -**Example 3:** deleting a setting whose stored value no longer matches its schema +**Example 3:** deleting a setting without a default whose stored value no longer matches its schema ```jsonc // Input -{ "data": { "posts_per_page": null } } +{ "data": { "start_of_week": null } } // Error { "code": "settings_invalid_stored_value", - "message": "The posts_per_page property has an invalid stored value, and cannot be updated to null.", + "message": "The start_of_week property has an invalid stored value, and cannot be updated to null.", "data": { "status": 500 } } ``` From 353cac2575e6a20771c81a91125f060d85c26f93 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Wed, 25 Nov 2026 22:48:54 +0000 Subject: [PATCH 09/13] Core shape: Refuse a trashed page and report every invalid stored value in `core/settings-update`. A null value for a setting without a default is refused only while it has a stored value that `core/settings-get` leaves out, so a boolean stored as false can be reset. The `settings_invalid_stored_value` error data maps each refused setting to its message under `params`, as Example 3 now shows. A page in the trash or an auto-draft is refused for the page settings. --- CORE-SHAPE.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index 6624a4c..2dfbbdf 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -833,9 +833,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/settings-update` - A `null` value resets a setting to its default, and stores the default so requests that do not register the setting read it too. A setting without a default has its stored value deleted, which is why the ability is `destructive`, and a `null` value for one without a stored value changes nothing. -- A `null` value for a setting without a default is refused with `settings_invalid_stored_value` while its stored value does not match its schema: `core/settings-get` leaves that value out, so the caller cannot see what would be deleted. A setting with a default always takes its default. +- A `null` value for a setting without a default is refused with `settings_invalid_stored_value` while it has a stored value that `core/settings-get` leaves out, because the value does not match the setting's schema: the caller cannot see what would be deleted. A boolean stored as false can be reset. A setting with a default always takes its default. The error data maps each refused setting to its message under `params`. - The ability is not `idempotent`, although repeating a call has no further effect: an ability that is both `destructive` and `idempotent` runs with the `DELETE` method, and this ability updates settings. -- A value that matches the schema but that the setting cannot use is refused with `settings_invalid_value`, and nothing is saved. This covers an unknown `timezone`, a `language` that is not installed, an unknown `default_post_format`, a page setting that is not 0 or the ID of a page, and a `default_category` that is not the ID of a category. The error data maps each refused setting to its message under `params`. +- A value that matches the schema but that the setting cannot use is refused with `settings_invalid_value`, and nothing is saved. This covers an unknown `timezone`, a `language` that is not installed, an unknown `default_post_format`, a page setting that is not 0 or the ID of a page, or is a page in the trash or an auto-draft, and a `default_category` that is not the ID of a category. The error data maps each refused setting to its message under `params`. - The site address (`url`) and the administration email address (`email`) are read-only: `core/settings-get` returns them, but they are left out of the input, under whatever name a plugin exposes them. Settings > General only changes the administration email address after the new address confirms it. **Example 1:** a title, a reading option and an option reset to its default @@ -872,7 +872,12 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th { "code": "settings_invalid_stored_value", "message": "The start_of_week property has an invalid stored value, and cannot be updated to null.", - "data": { "status": 500 } + "data": { + "status": 500, + "params": { + "data[start_of_week]": "The start_of_week property has an invalid stored value, and cannot be updated to null." + } + } } ``` From 32ad2e34f23e996ca7d7bf0361ce5cb79c096073 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Wed, 25 Nov 2026 23:02:07 +0000 Subject: [PATCH 10/13] Core shape: Add terms, featured media and site-time dates to the content write abilities. The `core/content-create` and `core/content-update` input and output describe `terms` (categories and tags by ID) and `featured_media`, with new examples for both, for a post scheduled in the site's time without an offset, and for restoring a post from the trash as a draft. The date section says how a value with and without an offset is read. The delete abilities list their `outcome` values, the media abilities use `application` as the media type of a file that is not an image, audio or video and allow a null `source_url`, and the duplicate term name error maps the name to its message under `params`. The `destructive` paragraph names the four delete abilities and `core/settings-update`. --- CORE-SHAPE.md | 212 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 191 insertions(+), 21 deletions(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index 2dfbbdf..b8ae47d 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -23,6 +23,8 @@ This document is the source of truth for the shape of the core abilities: their | [`core/term-update`](#coreterm-update) | Proposed | content | `false` | `false` | `true` | `POST` | | [`core/term-delete`](#coreterm-delete) | Proposed | content | `false` | `true` | `true` | `DELETE` | +`destructive` is `true` for an ability that removes something: the four `delete` abilities, which remove an entity, and `core/settings-update`, where a `null` value deletes the stored value of a setting without a default. A `create` or any other `update` is `false`, although an update overwrites the values it is given and can have a wide effect, such as a new role in `core/user-update`. This is narrower than the definition in core, where `false` means "only additive updates". The reason is the REST method: `destructive` and `idempotent` together make the method `DELETE`, so an idempotent update marked destructive would have to be called with `DELETE`. `core/settings-update` and `core/user-delete` are not idempotent, so their method is `POST`. + Errors are `WP_Error` objects. The `// Error` part of an example shows one as the REST response body (`code`, `message`, `data`); errors are not validated against the output schema. ## Content abilities @@ -30,7 +32,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/content-query` - Default `fields`: `id, type, status, date, slug, title.rendered`. +- `where.author` filters by the user's `id` or `slug`. There is no filter by `name` on purpose: a display name does not identify a user. The output `author` has all three: `id`, `name` and `slug`. - Trashed posts cannot be read today: `where.status` has no `trash` value. It gets one when `core/content-delete` is added. +- A post's terms and featured image cannot be read today: the output has no `terms` or `featured_media`. It gets both, in `fields` too, when `core/content-create` is added. **Example 1:** the drafts of the `post` type with chosen fields @@ -273,7 +277,13 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/content-create` - Default `fields`: `id, type, status, date, slug, title.rendered`. -- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. +- `data.author` takes a user ID, as `core/users-query` returns it. The output `author` is an object with `id`, `name` and `slug`. +- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. The offset is optional, and the value is read as the REST API reads `date` and `date_gmt`: + - With an offset, such as `2026-10-21T09:30:00+01:00` or `2026-10-21T08:30:00Z`, the value is that moment, in `site` and in `gmt` alike. + - Without an offset, such as `2026-10-21T09:30:00`, the value is site time in `site` and UTC in `gmt` (example 4). + - The output always has the offset. +- `data.terms` takes term IDs by taxonomy, as `core/terms-query` returns them. A taxonomy the post type does not use is refused like `parent` in example 5. +- `data.featured_media` takes the ID of an image, as `core/media-query` and `core/media-upload` return it. **Example 1:** a draft with the default fields @@ -319,7 +329,54 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th } ``` -**Example 3:** an attribute the post type does not support +**Example 3:** a post with categories, a tag and a featured image + +```jsonc +// Input +{ + "data": { + "type": "post", + "title": "Beta opens today", + "status": "publish", + "terms": { "category": [ 3, 9 ], "post_tag": [ 15 ] }, + "featured_media": 310 + }, + "fields": [ "status", "slug", "terms", "featured_media" ] +} + +// Output +{ + "id": 127, + "status": "publish", + "slug": "beta-opens-today", + "terms": { "category": [ 3, 9 ], "post_tag": [ 15 ] }, + "featured_media": 310 +} +``` + +**Example 4:** a post scheduled for 09:00 in the site's time, with no offset in the date + +```jsonc +// Input +{ + "data": { + "type": "post", + "title": "Beta closes today", + "status": "future", + "date": { "site": "2026-10-23T09:00:00" } + }, + "fields": [ "status", "date" ] +} + +// Output +{ + "id": 128, + "status": "future", + "date": { "site": "2026-10-23T09:00:00+01:00", "gmt": "2026-10-23T08:00:00+00:00" } +} +``` + +**Example 5:** an attribute the post type does not support ```jsonc // Input @@ -366,7 +423,25 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th } }, "author": { "type": "integer", "minimum": 1 }, - "parent": { "type": "integer", "minimum": 0 } + "parent": { "type": "integer", "minimum": 0 }, + "terms": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "category": { + "type": "array", + "uniqueItems": true, + "items": { "type": "integer", "minimum": 1 } + }, + "post_tag": { + "type": "array", + "uniqueItems": true, + "items": { "type": "integer", "minimum": 1 } + } + } + }, + "featured_media": { "type": "integer", "minimum": 0 } } }, "fields": { @@ -379,7 +454,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "modified.gmt", "slug", "link", "title", "title.raw", "title.rendered", "excerpt", "excerpt.raw", "excerpt.rendered", "excerpt.protected", "content", "content.raw", "content.rendered", "content.protected", "author", "author.id", "author.name", - "author.slug", "parent" + "author.slug", "parent", "terms", "terms.category", "terms.post_tag", "featured_media" ] } } @@ -454,7 +529,16 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "slug": { "type": [ "string", "null" ] } } }, - "parent": { "type": "integer" } + "parent": { "type": "integer" }, + "terms": { + "type": "object", + "additionalProperties": false, + "properties": { + "category": { "type": "array", "items": { "type": "integer" } }, + "post_tag": { "type": "array", "items": { "type": "integer" } } + } + }, + "featured_media": { "type": "integer" } } } ``` @@ -464,7 +548,12 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/content-update` - Default `fields`: `id, type, status, date, slug, title.rendered`. -- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. +- `data.author` takes a user ID, as `core/users-query` returns it. The output `author` is an object with `id`, `name` and `slug`. +- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. The offset is optional: without one the value is site time in `site` and UTC in `gmt`, as in `core/content-create`. +- `data.terms` replaces the post's terms in each taxonomy it names, and an empty list removes them; a taxonomy left out keeps its terms. +- `data.featured_media` takes the ID of an image; `0` removes the featured image. +- A trashed post is restored by sending `data.status`: it leaves the trash with that status and gets its slug back. Without `data.status` it stays in the trash. +- The comments that went to the trash with the post come back with it, each with the status it had before, as "Restore" does on the Posts screen. This goes beyond the REST posts endpoint, which restores the post and leaves those comments hidden, in the `post-trashed` status. **Example 1:** a new title and excerpt @@ -508,7 +597,39 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th } ``` -**Example 3:** a post the user cannot edit +**Example 3:** new tags and no featured image, with the categories left as they are + +```jsonc +// Input +{ + "where": { "type": "post", "id": 127 }, + "data": { "terms": { "post_tag": [ 15, 16 ] }, "featured_media": 0 }, + "fields": [ "terms", "featured_media" ] +} + +// Output +{ + "id": 127, + "terms": { "category": [ 3, 9 ], "post_tag": [ 15, 16 ] }, + "featured_media": 0 +} +``` + +**Example 4:** restoring a post from the trash as a draft + +```jsonc +// Input +{ + "where": { "type": "post", "id": 123 }, + "data": { "status": "draft" }, + "fields": [ "status", "slug" ] +} + +// Output +{ "id": 123, "status": "draft", "slug": "launch-notes-updated" } +``` + +**Example 5:** a post the user cannot edit ```jsonc // Input @@ -563,7 +684,25 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th } }, "author": { "type": "integer", "minimum": 1 }, - "parent": { "type": "integer", "minimum": 0 } + "parent": { "type": "integer", "minimum": 0 }, + "terms": { + "type": "object", + "additionalProperties": false, + "minProperties": 1, + "properties": { + "category": { + "type": "array", + "uniqueItems": true, + "items": { "type": "integer", "minimum": 1 } + }, + "post_tag": { + "type": "array", + "uniqueItems": true, + "items": { "type": "integer", "minimum": 1 } + } + } + }, + "featured_media": { "type": "integer", "minimum": 0 } } }, "fields": { @@ -576,7 +715,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "modified.gmt", "slug", "link", "title", "title.raw", "title.rendered", "excerpt", "excerpt.raw", "excerpt.rendered", "excerpt.protected", "content", "content.raw", "content.rendered", "content.protected", "author", "author.id", "author.name", - "author.slug", "parent" + "author.slug", "parent", "terms", "terms.category", "terms.post_tag", "featured_media" ] } } @@ -651,7 +790,16 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "slug": { "type": [ "string", "null" ] } } }, - "parent": { "type": "integer" } + "parent": { "type": "integer" }, + "terms": { + "type": "object", + "additionalProperties": false, + "properties": { + "category": { "type": "array", "items": { "type": "integer" } }, + "post_tag": { "type": "array", "items": { "type": "integer" } } + } + }, + "featured_media": { "type": "integer" } } } ``` @@ -661,6 +809,8 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/content-delete` - When this ability is added, `core/content-query` takes `trash` in `where.status`, so trashed posts can be read. +- A trashed post is restored with `core/content-update`, by sending `data.status`. With `permanent: true` it is deleted for good. +- The post's comments go to the trash with it, and come back with it when it is restored. **Example 1:** trashing a post @@ -732,7 +882,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "type": "object", "additionalProperties": false, "required": [ "outcome" ], - "properties": { "outcome": { "type": "string" } } + "properties": { + "outcome": { "type": "string", "enum": [ "trashed", "deleted" ] } + } } ``` @@ -1563,6 +1715,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/media-query` - Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. +- `where.author` filters by the user's `id` or `slug`. There is no filter by `name` on purpose: a display name does not identify a user. The output `author` has all three: `id`, `name` and `slug`. +- `media_type` in the output is the part of `mime_type` before the slash, the vocabulary `where.media_type` filters by: `image/jpeg` gives `image` and `application/pdf` gives `application`. It is a plain string and not the filter's enum, because an attachment can have a type that can no longer be uploaded, or no type at all, which gives an empty string. +- `source_url` is `null` when WordPress has no URL for the file, which happens when no file is recorded for the attachment. It is never an empty string. A size that has no URL is left out of `media_details.sizes`. **Example 1:** the images attached to post 123 with chosen fields @@ -1615,7 +1770,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "date": { "site": "2026-10-20T16:00:00+01:00", "gmt": "2026-10-20T15:00:00+00:00" }, "slug": "press-kit", "title": { "rendered": "Press kit" }, - "media_type": "file", + "media_type": "application", "mime_type": "application/pdf", "source_url": "https://example.test/wp-content/uploads/2026/10/press-kit.pdf" } @@ -1791,7 +1946,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "alt_text": { "type": "string" }, "media_type": { "type": "string" }, "mime_type": { "type": "string" }, - "source_url": { "type": "string", "format": "uri" }, + "source_url": { "type": [ "string", "null" ], "format": "uri" }, "filename": { "type": "string" }, "filesize": { "type": "integer" }, "media_details": { @@ -1848,7 +2003,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/media-upload` - Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. -- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. +- `data.author` takes a user ID, as `core/users-query` returns it. The output `author` is an object with `id`, `name` and `slug`. +- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. The offset is optional: without one the value is site time in `site` and UTC in `gmt`, as in `core/content-create`. +- `source_url` has the type it has in `core/media-query`, where it can be `null`. After an upload it is always a URL. **Example 1:** an image from a URL, attached to post 123 @@ -1917,7 +2074,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "date": { "site": "2026-10-20T16:00:00+01:00", "gmt": "2026-10-20T15:00:00+00:00" }, "slug": "press-kit", "title": { "rendered": "Press kit" }, - "media_type": "file", + "media_type": "application", "mime_type": "application/pdf", "source_url": "https://example.test/wp-content/uploads/2026/10/press-kit.pdf" } @@ -2069,7 +2226,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "alt_text": { "type": "string" }, "media_type": { "type": "string" }, "mime_type": { "type": "string" }, - "source_url": { "type": "string", "format": "uri" }, + "source_url": { "type": [ "string", "null" ], "format": "uri" }, "filename": { "type": "string" }, "filesize": { "type": "integer" }, "media_details": { @@ -2114,7 +2271,10 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/media-update` - Default `fields`: `id, status, date, slug, title.rendered, media_type, mime_type, source_url`. -- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. +- `data.author` takes a user ID, as `core/users-query` returns it. The output `author` is an object with `id`, `name` and `slug`. +- `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. The offset is optional: without one the value is site time in `site` and UTC in `gmt`, as in `core/content-create`. +- `source_url` is `null` when WordPress has no URL for the file, as in `core/media-query`. +- `data` has no `status`, so this ability cannot restore an attachment from the trash (see `core/media-delete`). **Example 1:** a caption and a new alt text @@ -2274,7 +2434,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "alt_text": { "type": "string" }, "media_type": { "type": "string" }, "mime_type": { "type": "string" }, - "source_url": { "type": "string", "format": "uri" }, + "source_url": { "type": [ "string", "null" ], "format": "uri" }, "filename": { "type": "string" }, "filesize": { "type": "integer" }, "media_details": { @@ -2319,6 +2479,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/media-delete` - When `MEDIA_TRASH` is off, which is the default, `permanent: true` is required: an attachment cannot be trashed there, only deleted. +- When `MEDIA_TRASH` is on, an attachment goes to the trash unless `permanent` is `true`. No ability restores it from there: `core/media-update` has no `status`, unlike `core/content-update`. It is restored on the Media Library screen. **Example 1:** a permanent deletion @@ -2377,7 +2538,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "type": "object", "additionalProperties": false, "required": [ "outcome" ], - "properties": { "outcome": { "type": "string" } } + "properties": { + "outcome": { "type": "string", "enum": [ "trashed", "deleted" ] } + } } ``` @@ -2548,6 +2711,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th ### `core/term-create` - Default `fields`: `id, taxonomy, name, slug, link`. +- A name already used under the same parent is refused with `term_exists`. The error names the input at fault in `data.params`, as `user_exists` does, and gives the existing term in `data.term_id` (example 3). **Example 1:** a child category under News @@ -2591,7 +2755,11 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th { "code": "term_exists", "message": "A term with the name provided already exists with this parent.", - "data": { "status": 400, "term_id": 9 } + "data": { + "status": 400, + "term_id": 9, + "params": { "data[name]": "A term with the name provided already exists with this parent." } + } } ``` @@ -2831,7 +2999,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "type": "object", "additionalProperties": false, "required": [ "outcome" ], - "properties": { "outcome": { "type": "string" } } + "properties": { + "outcome": { "type": "string", "enum": [ "deleted" ] } + } } ``` From 74eb0502c2681dd237a998170dd975ba308e8009 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Thu, 26 Nov 2026 16:30:44 +0000 Subject: [PATCH 11/13] Core shape: Check the content write capabilities in the permission callbacks and take back an empty draft slug. The `core/content-create` and `core/content-update` permission callbacks check the capabilities that `data.status` and `data.author` need, so every permission refusal is the generic permission error, as Example 5 of `core/content-update` now shows. The update slug takes the stored slug, also the empty slug of a draft, so a post from `core/content-query` can be sent back as it is, and the slug schema drops `minLength`. --- CORE-SHAPE.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index b8ae47d..2bb0ac6 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -284,6 +284,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th - The output always has the offset. - `data.terms` takes term IDs by taxonomy, as `core/terms-query` returns them. A taxonomy the post type does not use is refused like `parent` in example 5. - `data.featured_media` takes the ID of an image, as `core/media-query` and `core/media-upload` return it. +- A `data.status` that makes the post visible needs `publish_posts`, and a `data.author` other than the current user needs `edit_others_posts`. The permission callback checks both, so the refusal is the generic permission error, as in example 5 of `core/content-update`. **Example 1:** a draft with the default fields @@ -412,7 +413,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "type": "string", "enum": [ "publish", "future", "draft", "pending", "private" ] }, - "slug": { "type": "string", "minLength": 1 }, + "slug": { "type": "string" }, "date": { "type": "object", "additionalProperties": false, @@ -552,6 +553,8 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th - `data.date` takes `site`, `gmt` or both; `site` wins when both are sent. The offset is optional: without one the value is site time in `site` and UTC in `gmt`, as in `core/content-create`. - `data.terms` replaces the post's terms in each taxonomy it names, and an empty list removes them; a taxonomy left out keeps its terms. - `data.featured_media` takes the ID of an image; `0` removes the featured image. +- `data.slug` may be the stored slug, also the empty slug of a draft, so a post from `core/content-query` can be sent back as it is. Any other slug that is empty once sanitized is refused. +- The permission callback checks `edit_post` on the post, and the `data.status` and `data.author` capabilities as `core/content-create` does, so every permission refusal is the generic permission error (example 5). A direct `WP_Ability::execute()` call gets `ability_invalid_permissions` instead. - A trashed post is restored by sending `data.status`: it leaves the trash with that status and gets its slug back. Without `data.status` it stays in the trash. - The comments that went to the trash with the post come back with it, each with the status it had before, as "Restore" does on the Posts screen. This goes beyond the REST posts endpoint, which restores the post and leaves those comments hidden, in the `post-trashed` status. @@ -637,8 +640,8 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th // Error { - "code": "content_cannot_edit", - "message": "Sorry, you are not allowed to edit this post.", + "code": "rest_ability_cannot_execute", + "message": "Sorry, you are not allowed to execute this ability.", "data": { "status": 403 } } ``` @@ -673,7 +676,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "type": "string", "enum": [ "publish", "future", "draft", "pending", "private" ] }, - "slug": { "type": "string", "minLength": 1 }, + "slug": { "type": "string" }, "date": { "type": "object", "additionalProperties": false, From 591ffb8b88c08d1c5617883954f5ed8785ac924d Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 27 Nov 2026 12:09:25 +0000 Subject: [PATCH 12/13] Shape: Note the parent and pending slug checks in the content write permission callbacks. --- CORE-SHAPE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index 2bb0ac6..3b26a12 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -284,7 +284,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th - The output always has the offset. - `data.terms` takes term IDs by taxonomy, as `core/terms-query` returns them. A taxonomy the post type does not use is refused like `parent` in example 5. - `data.featured_media` takes the ID of an image, as `core/media-query` and `core/media-upload` return it. -- A `data.status` that makes the post visible needs `publish_posts`, and a `data.author` other than the current user needs `edit_others_posts`. The permission callback checks both, so the refusal is the generic permission error, as in example 5 of `core/content-update`. +- A `data.status` that makes the post visible needs `publish_posts`, and a `data.author` other than the current user needs `edit_others_posts`. A `data.slug` on a post that will be `pending` also needs `publish_posts`. A `data.parent` must be a post the current user can read, of a type exposed to abilities; a missing post is refused the same way, so the refusal never tells whether a post exists. The permission callback checks all of these, so the refusal is the generic permission error, as in example 5 of `core/content-update`. A parent of another type, or one that would make a loop, is refused as an invalid `data[parent]`. **Example 1:** a draft with the default fields @@ -554,7 +554,7 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th - `data.terms` replaces the post's terms in each taxonomy it names, and an empty list removes them; a taxonomy left out keeps its terms. - `data.featured_media` takes the ID of an image; `0` removes the featured image. - `data.slug` may be the stored slug, also the empty slug of a draft, so a post from `core/content-query` can be sent back as it is. Any other slug that is empty once sanitized is refused. -- The permission callback checks `edit_post` on the post, and the `data.status` and `data.author` capabilities as `core/content-create` does, so every permission refusal is the generic permission error (example 5). A direct `WP_Ability::execute()` call gets `ability_invalid_permissions` instead. +- The permission callback checks `edit_post` on the post, and the `data.status`, `data.author`, `data.parent` and `data.slug` rules as `core/content-create` does, with `publish_post` on the post for the slug of a pending post. A value that keeps the stored one needs none of these. So every permission refusal is the generic permission error (example 5). A direct `WP_Ability::execute()` call gets `ability_invalid_permissions` instead. - A trashed post is restored by sending `data.status`: it leaves the trash with that status and gets its slug back. Without `data.status` it stays in the trash. - The comments that went to the trash with the post come back with it, each with the status it had before, as "Restore" does on the Posts screen. This goes beyond the REST posts endpoint, which restores the post and leaves those comments hidden, in the `post-trashed` status. From d65e4fbb81c35e85beefceef478ce1c206cb728c Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Sat, 28 Nov 2026 13:10:38 +0000 Subject: [PATCH 13/13] Core shape: List the `deleted` and `removed` outcomes of `core/user-delete` in an enum. --- CORE-SHAPE.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CORE-SHAPE.md b/CORE-SHAPE.md index 3b26a12..4a5ff02 100644 --- a/CORE-SHAPE.md +++ b/CORE-SHAPE.md @@ -1707,7 +1707,9 @@ Errors are `WP_Error` objects. The `// Error` part of an example shows one as th "type": "object", "additionalProperties": false, "required": [ "outcome" ], - "properties": { "outcome": { "type": "string" } } + "properties": { + "outcome": { "type": "string", "enum": [ "deleted", "removed" ] } + } } ```