Repository navigation
Closed
Labels
Needs DevReady for, and needs developer effortsReady for, and needs developer effortsNeeds TestingNeeds further testing to be confirmed.Needs further testing to be confirmed.[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Describe the bug
I'm using a fresh install of the latest WordPress (v5.2.1) and latest Advanced Custom Fields Pro (v5.8.1), with no other plugins installed.
- Once a page is published, changing and previewing content does not work.
- Furthermore it hides the ACF content, but when clicking preview again shows the content - but is an older version of the content, clicking preview again then hides the content and so on.
It should be noted that when a page is not published it works correctly. If I switch the page back to draft the preview works correctly.
To reproduce
Steps to reproduce the behavior:
- Install ACF Pro 5.8.1 and create a field group with a text field called title, and show it on all posts that are pages (I can provide export of this code if needed)
- Add
<?php the_field('title'); ?>after line 17 oftemplate-parts/content/content-page.phpof twentynineteen theme - Create a page and write something in ACF Title like 'This is an ACF Title', then preview
- Should see 'This is an ACF Title' on page
- Then publish page
- Change content of ACF Title to 'This is an ACF Title 123' and click preview
- You should see no ACF Title
- Then click preview again
- Should see 'This is an ACF Title' (noting that '123' had not been added)
- Click preview again
- Should not see ACF Title
- You can click preview again and again to toggle hide/show of ACF content
Expected behavior
- A up-to-date preview of the changed Advanced Custom Fields content.
- When previewing the page multiple times WordPress should not be toggling showing/hiding of Advanced Custom Fields content
Screenshots
Preview working on unpublished pages:
Preview not working on published pages:
Previewing multiple times toggles the content on and off:
Desktop (please complete the following information):
- OS: OSX
- Browser chrome
- Version [74.0.3729.169 (Official Build) (64-bit)]
Additional context
- Please add the version of Gutenberg you are using in the description: Whatever is used in WordPress 5.2.1
- Here is a JSON export so the custom fields can be easily recreated, just save as a file and import using Custom Fields > Tools > Import Field Groups:
[
{
"key": "group_5cf7bf8106d4d",
"title": "Page",
"fields": [
{
"key": "field_5cf7bf875b9ca",
"label": "Title",
"name": "title",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"maxlength": ""
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "page"
}
]
],
"menu_order": 0,
"position": "acf_after_title",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": [
"permalink",
"the_content",
"excerpt",
"discussion",
"comments",
"revisions",
"slug",
"author",
"format",
"page_attributes",
"featured_image",
"categories",
"tags",
"send-trackbacks"
],
"active": true,
"description": ""
}
]
Reacted by Stefan Koller, Mike Wish, lauregch, David Millington, Sauli Rajala, Ben Word, Anna Rasshivkina, Mads Hostrup Mortensen, Rory Ashford-Bentley, Michael Keyser and 27 more
Reacted by Tran Thai Hoang, Jon Low, Will Skora and Stefan Fisk
Reacted by Tran Thai Hoang, Nils Dannemann and Jon Low
Reacted by Nils Dannemann, Jon Low and Alex B.
Reacted by amanda-t, wjcouch88@gmail.com, Andrea Brunato, Sophia Zey, ejke, Ben Word, Tran Thai Hoang, Clint, Jon Low, Esa-Matti Suuronen and 5 more
Metadata
Metadata
Assignees
Labels
Needs DevReady for, and needs developer effortsReady for, and needs developer effortsNeeds TestingNeeds further testing to be confirmed.Needs further testing to be confirmed.[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended



Activity
talldan commentedon Jun 11, 2019
Thanks for the details @altescape, really great bug report.
Out of interest, if you save the post (cmd+s/ctrl+s) before clicking preview do you see the latest changes? If so, that might be a (not ideal) workaround.
The issue might be that the fix (#14877) for the previous preview issue (#12617) involved disabling the saving of metaboxes when the preview button is clicked. Unfortunately the metabox save process was causing post revisions to be deleted.
I created an issue #14900 to consider ways to re-enable metabox saving when previewing. It's not a simple thing to fix unfortunately.
mj-watts commentedon Jun 12, 2019
Thanks for the heads up @talldan - I'll have a look also at the issue you created.
cmd+s didn't work, WordPress only allows saving when I've edited WordPress blocks and not metaboxes, thank you for the tip though - I'll wait for further updates regarding this.
corywebb commentedon Jun 17, 2019
I am seeing a similar issue without ACF. Preview is not working on an already-published post if an autosave of the post exists. Here are the steps to reproduce:
The preview works for me when an autosave does not exist, but it does not work when an autosave exists.
tomjn commentedon Jun 18, 2019
@altescape is there an equivalent ACF support post? It'd be good to cross reference and debug faster. It's possible this is an ACF specific issue, but if it isn't it'd be good for debugging to track down where things go wrong and improve Gutenberg accordingly
amanda-t commentedon Jun 19, 2019
@tomjn Most recent thing I've seen from ACF is AdvancedCustomFields/acf#186
corywebb commentedon Jul 1, 2019
@tomjn this issue isn't just happening with ACF. See my previous comment above: #16006 (comment)
dartiss commentedon Jul 2, 2019
This issue is occurring for a WordPress VIP client. If anyone within the Automattic Gutenberg team are able to look at this, it would be appreciated.
jweston491 commentedon Jul 18, 2019
This bug is still occurring for me.
Using Twenty-Nineteen with 5.2.2 with ACF Pro 5.8.2
andreabrunato commentedon Jul 31, 2019
This bug till occurring for me, only in preview of published posts.
Using Sage Roots theme (customized by me), WP 5.2.2 e ACF Pro 5.8.2.
Both in local server and online.
newhope commentedon Aug 1, 2019
Still occurring for me.
Need to switch back to classic editor.
cyberphen commentedon Aug 6, 2019
Can confirm, happening with me.
ejke commentedon Aug 13, 2019
Adding my voice, occurring to me as well.
Wordpress 5.2.2, ACF Pro 5.8.3.
I solved the problem temporarily by installing and activating Disable Gutenberg plugin, but as I would like to be able to use both ACF and Blocks, it's not a long-term solution.
atomiccherry commentedon Aug 21, 2019
Experiencing same issue as well.
df165 commentedon Sep 27, 2019
Also experiencing this issue. Edit: ejke's solution of installing Disable Gutenberg plugin worked for me.
42 remaining items
TimDix commentedon Nov 26, 2021
I tried to use the Yoast Duplicate Post plugin as a workaround for this issue. There's a Rewrite & Republish feature which lets you save the ACF Meta fields to the draft, and therefore I can get working previews. And I found it worked even better than expected. The Preview works fully without saving drafts and includes ACF Meta updates.
Workaround Steps:
You should see your ACF Meta fields are now properly updated in the preview!
https://wordpress.org/plugins/duplicate-post/
Not an ideal workaround since it requires extra steps, however it's workable and can be built into workflow to just always Rewrite & Publish for updates.
Perhaps this workaround can help identify a basis for an official solution?
WordPress Version 5.8.2
ACF Pro Version 5.11.1
Yoast Duplicate Post Version 4.2
okadots commentedon Dec 17, 2021
Having the same issue where ACF fields that are not blocks don't update in preview once a page is made live.
The solution posted here (the one from darkly77 at the bottom) is working for me.
https://support.advancedcustomfields.com/forums/topic/custom-fields-on-post-preview/
stefanfisk commentedon Feb 9, 2022
I just now discovered that I am also affected by this when previewing pages that use ACF blocks. Said workaround seems to work.
lichtmetzger commentedon May 19, 2022
It does work somewhat because it shows the current state of a site before doing any further edits. New changes are not reflected in the preview though, making the preview at least do something, but still not being very useful.
The preview seems to work fully when creating a new page, though, which is nice.
kory-northrop commentedon Feb 15, 2023
Another year has gone by without any updates. What is the status of a fix for this issue? It still exists....
dipak-webo commentedon Apr 18, 2023
Guys I wonder, when autosaved it creates a new row in the posts table with a unique ID, why can't save meta values referencing to this ID? Isn't it simple? My project actually heavily depends on meta values and when I can't preview them, it's so weird.
tripflex commentedon Mar 25, 2024
Almost 5 years later and now Gutenburg is the default editor, how is this not something being looked at all?? This is not just an issue with ACF, it's an issue with ANY custom meta boxes.
Is WordPress/Gutenburg of the opinion that these things should be handled by plugins (and not handled natively like it is with classic editor)?
isuke01 commentedon Aug 27, 2024
I wonder if this ever gonna be "fixed".
adamsilverstein commentedon Nov 3, 2024
we do revision post meta now, so this should be resolved or resolvable.
SiteBoltsAdmin commentedon Nov 11, 2024
We noticed today that WordPress's "Preview Changes" feature wasn't working correctly for ACF fields; the preview was showing their published values rather than the previewed values.
We tried out several suggested PHP snippets but found that they didn't resolve the issue.
After seeing this suggestion:
We did some testing and confirmed that the issue occurs when post revisions are disabled. In our case, it was due to our WordPress host (WPEngine) disabling post revisions by default. We were able to fix it by contacting their support and having them set the number of post revisions to 3.
adamsilverstein commentedon Dec 12, 2024
So you can confirm this works fine when revisions are enabled? thinking we can close this ticket as resolved.
jasonbahl commentedon Dec 12, 2024
@adamsilverstein thanks for following up!
I tested my use case above (#16006 (comment)) and core meta that is revised, such as footnotes, appears to work as I would expect.
However, ACF meta does not work as expected, but I believe this is something the ACF team will need to work on implementing now that there is formal core support for meta revisions.
Here's an example of my use case of using WPGraphQL to query for a Published Post and a Preview of the same post with unpublished changes.
I used footnotes as an example, and added a
footnotesfield to the WPGraphQL Schema like so:I also had to filter WPGraphQL to tell it that the
footnotesmeta key is revised (ideally WPGraphQL should be able to detect this from the meta registry - I just opened this issue to address: wp-graphql/wp-graphql#3260):I then published a post with some footnotes, and then made some unsaved changes to the footnotes and previewed it.
I was able to query and see both the published footnotes and preview footnotes.
I think from my perspective, this is likely resolved from WordPress core / gutenberg standpoint, and at this point (at least for my specific use case) the ACF team will need to work on some changes to ensure meta fields are stored on revisions in the same way core fields like footnotes are, as the ACF-specific use case is not working for me, but I believe there's enough evidence to show that ACF should now be able to hook into the block editor in some way and revision meta similar to how they revise meta on non-block-editor posts.
Mamaduka commentedon May 7, 2025
I'm going to close this as resolved. Revision now can be enabled for post meta, and plugins like ACF can leverage this feature.
Details: https://make.wordpress.org/core/2023/10/24/framework-for-storing-revisions-of-post-meta-in-6-4/.