Repository navigation
Conversation
Restoring a revision applied it as edits and saved the post, which left values that classic meta boxes save through their own form submission at the newer version, and resubmitted them on the next save. It also only covered the fields the editor knows about. Restoring now runs wp_restore_post_revision through a new REST route and loads the editor again, the way the classic revisions screen works, so everything a revision holds comes back and the meta boxes render with the restored values. 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. |
|
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. |
|
Size Change: -330 B (0%) Total Size: 7.91 MB 📦 View Changed
|
|
Flaky tests detected in 96a9518. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/33139968420 Navigates the items list via UP/DOWN arrow keys in
|
What?
Follow up to #78249, which turned Visual Revisions off whenever classic meta boxes are registered, as a way around the restore bug in #78130.
Restoring a revision now happens on the server, and Visual Revisions works again when classic meta boxes are present.
Why?
The editor restored a revision by applying it as edits and saving the post. That has two problems:
wp_restore_post_revision, were left alone. The classic screen restores all of it.How?
POST /wp/v2/<base>/<id>/revisions/<id>/restorerunswp_restore_post_revision(), the same functionrevision.phpuses. It is added toGutenberg_REST_Revisions_Controller, and to a newGutenberg_REST_Template_Revisions_Controllerso templates keep working.disableVisualRevisionsis removed, along with the classic screen links on the two revisions controls, the deep link redirect, and the autosave notice branch that read it.Testing Instructions
gutenberg-test-plugin-revisions-meta-boxtest plugin, or any plugin with a classic meta box that saves meta registered withrevisions_enabled.Also worth checking on a post type without meta boxes, and on a template in the site editor.
Testing Instructions for Keyboard
Tab to Revisions in the sidebar and press Enter, move through the revisions with the slider arrow keys, then tab to Restore and press Enter.
Screenshots or screencast
After restoring, the classic meta box field holds the restored value:
Use of AI Tools
Authored with Claude Code assistance.