Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#50388 closed enhancement (wontfix)

REST API: Add action-delete flag to declare delete_post capability for post objects

Reported by: ocean90's profile ocean90 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch has-unit-tests
Focuses: rest-api Cc:


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

Change History (8)

#1 follow-up: @TimothyBlynJacobs
4 years ago

Why can't this be discovered through the Allow header?

This ticket was mentioned in PR #335 on WordPress/wordpress-develop by ocean90.

4 years ago

  • Keywords has-patch has-unit-tests added

#3 in reply to: ↑ 1 @ocean90
4 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 Allow header?

Haven't seen your comment until now but indeed, the Allow header can be used and was actually implemented via

#5 @swissspidy
3 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 @TimothyBlynJacobs
3 years ago

We should implement targetHints, Essentially we'd add something like this to self links.

  "self": [
      "href": "",
      "targetHints": {
        "allow": [

Another use case: #41740.

Last edited 3 years ago by TimothyBlynJacobs (previous) (diff)

#7 @swissspidy
3 years ago

That'd work I think! Does this warrant a new ticket or reopening this one?

#8 @TimothyBlynJacobs
3 years ago

Awesome! I think a new ticket for adding targetHints would make sense.

Note: See TracTickets for help on using tickets.