Repository navigation
Status field: Own the rule that leaves Trash out of the status options - #87552
Conversation
A post goes to the trash through the "Move to trash" action, not by editing its status. The field keeps the `trash` element, which filters and views need to label a trashed post, and its own `Edit` now leaves it out of the radio options, so every form gets that without filtering the elements itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The status field's control no longer offers the trash, so the quick edit modals and the inspector don't need to filter it out of the elements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +5.02 kB (+0.06%) Total Size: 8.73 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. page-list submenu user interactions in
|
| const { editEntityRecord, saveEditedEntityRecord } = | ||
| useDispatch( coreDataStore ); | ||
|
|
||
| const _fields = usePostFields( { postType } ); |
There was a problem hiding this comment.
This was great to achieve.
| return array( | ||
| 'type' => 'text', | ||
| 'label' => __( 'Status' ), | ||
| 'Edit' => 'radio', |
There was a problem hiding this comment.
I think there's potential to do this differently: instead of implementing a custom Edit, we could pass some meta info to the elements to control where each element is displayed. For example, something along the lines of visibility: [ 'filter', 'view' ] (to hide the element on edit) or just more directly visibility: cannot-edit. I went for the custom Edit to minimize API changes until more use cases emerge for this kind of thing.
What?
Follow up to #87541. Related to #87547.
Moves the rule that keeps "Trash" out of the status options from the forms into the status field.
Why?
A post goes to the trash through the "Move to trash" action, not by editing its status. Every form that edits the status removed the
trashelement by hand: the quick edit modals of both site editors and the editor's inspector.The field can't simply drop the element, because DataViews uses the same
elementsto label values: the Trash view's locked filter would read "Status" instead of "Status includes: Trash", and the status of a trashed post would lose its label.How?
@wordpress/core-fields): adds anEdit, aRadioGroupControlof@wordpress/ui, that leavestrashout of the options. Thetrashelement stays, so filters and views keep labelling it. Changes still go through the field'ssetValue, andisDisabledstill applies. The server-side'Edit' => 'radio'is removed, since the script part now provides the control.packages/edit-siteandroutes/post-list) and the inspector (packages/editor): drop their owntrashfilters. In the site editor v1 modal nothing else changes the fields, so it uses them as they come.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
The status options in the inspector look as they did before: five statuses and the password option.
Use of AI Tools