Repository navigation
Conversation
The revisions sidebar diffed only the post meta the REST API exposes, and labelled each row with the raw meta key. Plugins have long registered fields for the classic revisions screen through _wp_post_revision_fields, with a name to show, and none of that reached the editor. Revisions now carry those fields in the REST response, and the sidebar panel lists them under the name the plugin gave them, falling back to the meta it already showed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
1 similar comment
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If 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. |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Size Change: +133 B (0%) Total Size: 7.92 MB 📦 View Changed
|
What?
See #78130. The revisions sidebar now shows the fields plugins register with
_wp_post_revision_fields, under the names they gave them, so a plugin that has no editor JS still has its data shown when comparing revisions.Why?
The sidebar panel diffed
revision.metafrom the REST response, which is only the post meta registered withshow_in_rest, and it labelled every row with the raw meta key. Plugins have always described their revisioned data to the classic screen through_wp_post_revision_fields, which returns a key and a human readable name, and_wp_post_revision_field_{$field}, which returns the value for a given revision. None of that reached the editor, so a plugin without REST or JS had nothing to show, and a plugin with REST meta got its key printed at the reader.How?
Gutenberg_REST_Revisions_Controlleradds arevision_fieldsobject ofkey => { label, value }, built from_wp_post_revision_fields()minus the fields already in the response, with each value passed through the plugin's own field filter, the same call the classic screen makes. It is in the edit context only, and drops fields with no value.RevisionDiffPaneltakes an optionallabelsmap, and the fields panel prefers a registered field over the same key in meta, keeping the REST meta rows for keys nothing registered.Two things worth knowing. Plugins that add these filters inside an
is_admin()guard will not surface, because a REST request is not an admin request; the "Open classic revisions screen" link stays the way to see those. And the field is only computed for requests that ask for it, which for the editor is the revisions the sidebar diffs.Best read alongside #82158, which makes restoring reach the same data. Neither depends on the other.
Testing Instructions
gutenberg-test-plugin-revision-fieldstest plugin, or add your own_wp_post_revision_fieldsentry for a meta key registered withrevisions_enabled.revision.phpshows.Testing Instructions for Keyboard
Tab to Revisions in the sidebar and press Enter, then tab to the Fields panel and press Enter to expand it.
Screenshots or screencast
Use of AI Tools
Authored with Claude Code assistance.