-
Notifications
You must be signed in to change notification settings - Fork 32
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 revert to empty fields #21
Comments
Well - for me it didn't seem to be going to blank specifically - but it seems to be going one revision off. Here is what I had tried:
Can you try to extend your test to see if that is what is happening for you? |
@Marus, I'm experiencing the same as you. Any progress? Will update here if I learn anything of value. |
I have exactly the same experience @Marus described. Is there any progress on this? |
@davidbenton @Marus @sarahovenall Thanks for your reports and patience in me getting back to you here. Are you using a custom post type or standard WordPress posts? Can you give me more details about how you are creating the custom meta fields and how you are saving them? With standard posts the plugin should actually work as expected. Because of the way WordPress core fires revisions and this plugin hooks in, you will find meta revisions 'off by one' for custom post types (and probably pages) because the revision is saved before the meta gets updated. You can correct this by hooking your meta save on 'save_post For testing, you may want to check out this branch where I have the meta fields showing in the revisions UI so you can see what was saved with each post and if they match. |
It was a custom post type in my case, @adamsilverstein, so it sounds like you have a solution. I ended up rolling the basic functionality we needed into the plugin we were building, so we're not using wp-post-meta-revisions anymore. Thanks for your work on this; seems like it'll be a great contribution to core. |
@adamsilverstein If you can link me to your work on core I'm happy to add my voice supporting a fix to the off-by-one bug. I can double-check my scenario, but you and @Marus make it seem like the issue is off-by-one rather than empty fields. |
I think this should be fixed in PR #28. Since the meta values of the revision got selected with the |
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). |
for a workaround to the off by one issue, see this comment: #17 (comment) |
The text was updated successfully, but these errors were encountered: