Recycle Bin: show item type badges inline next to title#206
Merged
Conversation
Closes #205. Each row in the Recycle Bin now carries a small uppercase badge ("POST", "PAGE", "MEDIA", "COMMENT", or the CPT's singular label) inline before the title, so mixed-trash lists are scannable without opening each item. - Server: shape every row with a `type_label` field, resolved from the post-type object for posts and CPTs (so e.g. trashed WooCommerce products read as "Product"), hard-coded to "Media" for attachments and "Comment" for comments. - Client: render the badge inline in the title cell with inline styles (`<wpd-table>` body lives in a shadow DOM that blocks document stylesheets), with a desaturated per-type color palette and a generic fallback for unknown slugs. - Plugins can override the label from `desktop_mode_recycle_bin_item` — documented in the example.
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
6 tasks
epeicher
added a commit
that referenced
this pull request
May 14, 2026
Three Trash-bin improvements driven by PR #206 feedback: - URL placements (file_type='link') now carry a 'URL' type_label, so the inline badge reads "URL" instead of the generic "Placement". Other placement kinds keep the existing humanized bucket label. - Trash icon badge updates live when a URL/shortcut/folder is moved to Trash. The desktop-files trash helper was emitting { reason: 'trash' } which the badge subscriber couldn't decode; it now follows the cross-window convention { source, action, ids } matching how posts/pages/attachments already broadcast. The badge also subscribes to the placement / shortcut / folder channels. - Removes the `pre_delete_attachment` interception so media files follow vanilla WordPress behavior — permanent-delete on first click, no auto-routing through Trash. This resolves the "plugin .zips show up as Media in Trash bin" feedback at the source: nothing auto-trashes them anymore. Sites that want media-in-trash can opt in by setting `MEDIA_TRASH=true` in `wp-config.php`; the Recycle Bin still tracks `attachment` in its default capture_post_types list, so trashed media surfaces automatically when something else (REST, programmatic trash, MEDIA_TRASH-enabled delete flow) routes it there. Coverage: 4 PHPUnit cases for the URL label, the no-auto-trash default, and the unaffected post-trash flow. 3 vitest cases verifying the placement / shortcut / folder broadcast shape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #205.
Summary
POST,PAGE,MEDIA,COMMENT, or the CPT's singular label.type_labelfrom the post-type object so e.g. a trashed WooCommerce product reads as "Product".Implementation notes
desktop_mode_recycle_bin_shape_item()and..._shape_comment_item()now emit atype_labelfield. Attachments collapse to "Media" to match the toolbar filter; unknown slugs fall back to a title-cased version of the slug.makeTypeBadge()helper renders the badge with inline styles (the<wpd-table>body lives in a shadow DOM that blocks document stylesheets, so all visual properties have to come from inlinestyle.*assignments). A small desaturated palette keeps the badges readable as metadata, not primary content.row.typeiftype_labelis missing, so the badge still shows for rows from a plugin that doesn't populate the new field.desktop_mode_recycle_bin_itemfilter — documented indocs/examples/recycle-bin.md.Test plan
npm run lintcleannpx tsc --noEmitcleannpm run test:js— 1155 tests passnpm run buildsucceeds