[wp-trac] [WordPress Trac] #63670: Add trashability to REST API posts controller (was: Add trashability to REST API attachment controller)

WordPress Trac noreply at wordpress.org
Tue Jul 29 07:07:06 UTC 2025


#63670: Add trashability to REST API posts controller
---------------------------+------------------------------
 Reporter:  isabel_brison  |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  REST API       |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:
---------------------------+------------------------------

Old description:

> Would be good to have a `trashable` property to the attachment schema
> that checks the MEDIA_TRASH constant.
>
> This will be needed to display the correct actions for media items in
> data views.

New description:

 Would be good to have a `trashable` property to the posts schema that
 checks the "rest_{$this->post_type}_trashable" filter and, in the case of
 attachment post type, the MEDIA_TRASH constant too.

 This will be needed to display the correct actions for media items in data
 views, and also for other post types to which the filter may be applied.

--

Comment (by isabel_brison):

 Thinking about this more, and on a suggestion by @talldanwp, I'm updating
 the scope of this ticket to apply not just to the attachment controller,
 but to the posts controller. The logic is that there are other default
 post types not trashable by default (such as templates), but the
 "rest_{$this->post_type}_trashable" could potentially be used to change
 this for any post type.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63670#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list