#50388 closed enhancement (wontfix)
REST API: Add action-delete flag to declare delete_post capability for post objects
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | REST API | Keywords: | has-patch has-unit-tests |
| Focuses: | rest-api | Cc: |
Description
Previously: #44287
To allow REST API clients to display a delete link for posts in their UI based on current user's capabilities we should provide an action-delete flag similar to the existing actions like action-publish.
One consumer would be the block editor as reported in https://github.com/WordPress/gutenberg/issues/23144.
Change History (8)
This ticket was mentioned in PR #335 on WordPress/wordpress-develop by ocean90.
6 years ago
#2
- Keywords has-patch has-unit-tests added
Trac ticket: https://core.trac.wordpress.org/ticket/50388
#3
in reply to:
↑ 1
@
6 years ago
- Milestone 5.5 deleted
- Resolution set to wontfix
- Status changed from new to closed
Replying to TimothyBlynJacobs:
Why can't this be discovered through the
Allowheader?
Haven't seen your comment until now but indeed, the Allow header can be used and was actually implemented via https://github.com/WordPress/gutenberg/pull/23174.
6 years ago
#4
Superseded by https://github.com/WordPress/gutenberg/pull/23174.
#5
@
5 years ago
@TimothyBlynJacobs @ocean90 The Allow header works for wp/v2/posts/<id> requests. But what if I fetch a list of posts from wp/v2/posts/ and for each item want to know whether I can delete it?
#6
@
5 years ago
We should implement targetHints, https://tools.ietf.org/id/draft-handrews-json-schema-hyperschema-00.html#rfc.section.6.5.5. Essentially we'd add something like this to self links.
{
"self": [
{
"href": "https://example.org/wp-json/wp/v2/posts/1",
"targetHints": {
"allow": [
"GET",
"PUT",
"DELETE"
]
}
}
]
}
Another use case: #41740.
Why can't this be discovered through the
Allowheader?