Repository navigation
REST API: Add a route to restore a revision - #16315
adamsilverstein wants to merge 2 commits into
Conversation
The block editor restores a revision by copying its fields into a post update, so `wp_restore_post_revision()` does not run: the `wp_restore_post_revision` action does not fire and revisioned meta that is not shown in REST is not restored. Add `POST /wp/v2/<base>/<parent>/revisions/<id>/restore`, which restores through `wp_restore_post_revision()` as the revisions screen does and returns the restored parent in the `edit` context. See #66865.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: 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:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
A request value is untyped, and a template is addressed by a string ID where other post types use an integer. Read the parent through a method that each revisions controller implements for its own ID type, so that the restore route passes PHPStan at level 10. See #66865.
Trac ticket: https://core.trac.wordpress.org/ticket/66865
Core side of WordPress/gutenberg#82158.
Claude Code (Fable 5.2) ported the route from the Gutenberg PR and wrote this description:
AI Use
Claude Code (Fable 5.2) wrote the route, the tests and this description. I will review and test.
🤖 Generated with Claude Code