You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From my testing, restoring a revision of a pattern is broken. Doing so throws an error (The wp_pattern_sync_status property has an invalid stored value, and cannot be updated to null.):
I reproduced the error as far back as WordPress 7.0, which would align with when visual revisions were introduced. My guess is the visual revisions aren't restoring post meta, so it might be broader than just pattern post types.
Step-by-step reproduction instructions
Create a post
Add some blocks and select them
Using the block settings menu, convert the blocks to a synced pattern
From the synced pattern toolbar, click Edit original
Make several edits, saving each time to create revisions
From the sidebar in the Pattern tab, click the revisions number to open the revisions UI
Try restoring an old revision
Observe the error
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Please confirm which theme type you used for testing.
I am able to replicate the issue locally with the latest Gutenberg. I also noticed that restoring an unsynced pattern converts it into a synced pattern. I will debug more on this.
This is broader than patterns, and it's the opposite of not restoring meta: Visual Revisions restores all of the revision's meta, including keys that aren't revisioned.
restoreRevision fetches the revision's meta and copies the whole object onto the post before saving:
For patterns, wp_pattern_sync_status isn't revisioned and only allows partial or unsynced, so the revision returns null. Saving null deletes the key, which is why an unsynced pattern becomes synced. A synced pattern has no stored value, which also fails the enum, so the update errors with "cannot be updated to null":
On other post types it's silent: restoring resets every non-revisioned show_in_rest key. Strings are saved as '', keys with a registered default get that default, and non-single keys are deleted. Repro on WordPress 7.1.3 with no plugins:
The editor can't tell which keys are revisioned, since revisions_enabled isn't exposed over REST. So the fix likely needs the server: the revisions endpoint returning only wp_post_revision_meta_keys() in meta, or restoring on the server as #82158 did.
Thanks @davidsword for the detailed analysis!
I was looking at an approach that skips null values from the revision's meta in restoreRevision.
It fixes both pattern cases (the error on synced patterns and unsynced patterns becoming synced). But as you've shown, the root cause is broader than a null check: non-revisioned keys that come back as '', as their default, or as [] would still be overwritten, so it probably needs a server-side fix instead.
Activity
umeshnevase commentedon Oct 15, 2026
@talldan
I attempted to replicate the issue on WordPress 7.0 and 7.1.3 but was unable to reproduce it.
prasadkarmalkar commentedon Oct 15, 2026
I am able to replicate the issue locally with the latest Gutenberg. I also noticed that restoring an unsynced pattern converts it into a synced pattern. I will debug more on this.
davidsword commentedon Oct 15, 2026
This is broader than patterns, and it's the opposite of not restoring meta: Visual Revisions restores all of the revision's meta, including keys that aren't revisioned.
restoreRevisionfetches the revision'smetaand copies the whole object onto the post before saving:gutenberg/packages/editor/src/store/private-actions.js
Lines 712 to 757 in 55d109b
The revisions endpoint returns every
show_in_restkey registered for the parent post type, read from the revision ID:https://github.com/WordPress/wordpress-develop/blob/2995d9665a205841390f6c5adc6419ac888428fb/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php#L715-L716
A key without
revisions_enabledis never stored on the revision, so it comes back as its schema default, ornullif that default fails the schema:https://github.com/WordPress/wordpress-develop/blob/2995d9665a205841390f6c5adc6419ac888428fb/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php#L86-L93
https://github.com/WordPress/wordpress-develop/blob/2995d9665a205841390f6c5adc6419ac888428fb/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php#L571-L573
For patterns,
wp_pattern_sync_statusisn't revisioned and only allowspartialorunsynced, so the revision returnsnull. Savingnulldeletes the key, which is why an unsynced pattern becomes synced. A synced pattern has no stored value, which also fails the enum, so the update errors with "cannot be updated to null":https://github.com/WordPress/wordpress-develop/blob/2995d9665a205841390f6c5adc6419ac888428fb/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php#L160-L182
On other post types it's silent: restoring resets every non-revisioned
show_in_restkey. Strings are saved as'', keys with a registereddefaultget that default, and non-single keys are deleted. Repro on WordPress 7.1.3 with no plugins:wp post meta update <ID> kept_meta hello."meta":{"kept_meta":"","footnotes":""}, andkept_metais now empty.Core's classic restore only touches
wp_post_revision_meta_keys():https://github.com/WordPress/wordpress-develop/blob/2995d9665a205841390f6c5adc6419ac888428fb/src/wp-includes/revision.php#L534-L548
The editor can't tell which keys are revisioned, since
revisions_enabledisn't exposed over REST. So the fix likely needs the server: the revisions endpoint returning onlywp_post_revision_meta_keys()inmeta, or restoring on the server as #82158 did.prasadkarmalkar commentedon Oct 16, 2026
Thanks @davidsword for the detailed analysis!
I was looking at an approach that skips
nullvalues from the revision's meta inrestoreRevision.It fixes both pattern cases (the error on synced patterns and unsynced patterns becoming synced). But as you've shown, the root cause is broader than a
nullcheck: non-revisioned keys that come back as'', as their default, or as[]would still be overwritten, so it probably needs a server-side fix instead.REST API: Only include revisioned meta in revision responses.
talldan commentedon Oct 19, 2026
Thanks for the testing and diagnosis of the issue.
I've made a trac ticket (https://core.trac.wordpress.org/ticket/66336) as well for this, which will be needed for the current fix- WordPress/wordpress-develop#14359. (edit: there was an existing trac ticket https://core.trac.wordpress.org/ticket/66329)annezazu commentedon Oct 20, 2026
@ellatrix tagging you in this for awareness and in case you can dig in.
adamsilverstein commentedon Oct 20, 2026
The analysis from @davidsword seems right - only the revisioned meta fields should be restored.
Any empty (revisioned) meta value is valid, so those get restored as well, potentially clearing the field.
The functionality of restoring a revision should match
wp_restore_post_revision_metafrom core as closely as possible (exactly).