#50388 closed enhancement (wontfix)
REST API: Add action-delete flag to declare delete_post capability for post objects
| Reported by: | ocean90 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | REST API | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | rest-api |
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
- Resolution → wontfix
- Status new → 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"
]
}
}
]
}
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Why can't this be discovered through the
Allowheader?