-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Preview/Autosave not saving meta fields #20755
Comments
I think this is a feature, not a bug. Meta boxes should only save on full saves, see #7502 |
So this "feature" does: I'd really like to show my custom fields to user, they are kind of important during preview. But without Gutenberg everything works fine. Actually this "old trick" https://core.trac.wordpress.org/ticket/20299 |
It does not save on autosave, because there is no meta revision. If a user or wordpress saves a post, the old meta data is overriden and you can't undo the change. But you are right. If you have a new post and just want to preview it, it should save the data, because there is no old data. |
Ok, so is there any way to force save meta for review using Gutenberg? As I mentioned before, it works correctly without Gutenberg, same setup. |
The preview issue is tracked here - #14900. Unfortunately saving metaboxes during preview caused preview not to work correctly (it deleted the revision caused by the preview). It's not a trivial thing to fix, unfortunately. |
Describe the bug
I noticed that issue using ACF 5.8.8. First I did some tests, I have read I have to use
'show_in_rest' => true
so I did some tests, and still looks like it does not work at all.I have created custom meta but nothing is saved.
Also I noticed during preview save action inside hook
post_save
value for$_POST
are empty so it might be an issue too.I tested that without Gutenberg, same setup, everything work as expected.
To reproduce
Here is code I used for tests:
For Autosave
For preview:
Expected behavior
Those custom meta fields must be saved during preview for proper display on frontend.
Auto save also must save meta fields that user entered.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: