Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta revisions not attached to expected post revision #57

Open
CheesyUK opened this issue Apr 23, 2019 · 2 comments
Open

Meta revisions not attached to expected post revision #57

CheesyUK opened this issue Apr 23, 2019 · 2 comments

Comments

@CheesyUK
Copy link

When carrying out a series of post / post meta updates, it doesn't appear to store the two in sync properly.

Replication
Create a new post.
Add post content 'Content 1'
Add meta in a whitelisted field 'Meta 1'
Save content

Make content change 'Content 2'
Make change to whitelisted meta field 'Meta 2'
Save content

etc.

Click on revisions created and restore.
Post content example 'Content 2'
Meta content example 'Meta 1'

Expected result
I would expect that restoring 'Content 2' would result in also restoring 'Meta 2'

@CheesyUK
Copy link
Author

CheesyUK commented Jun 6, 2019

I re-tested this process on a fresh install and I am seeing the same effect here.
Are others able to replicate this issue? Is this an expected result?

@adamsilverstein
Copy link
Owner

@CheesyUK Are you using a custom post type?It looks like your revisions "off by one", check this comment for a potential solution: #21 (comment)
In short...
"The off by one issue is can be corrected this by hooking your meta save on 'save_post' instead of 'save_post{post_type}` (you can bail early in the callback to only handle your CPT)."_

See also #17 (comment) for another potential solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants