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

Gutenberg post preview doesn't display ACF custom fields #224

Open
sebrosen opened this issue Sep 21, 2019 · 12 comments
Open

Gutenberg post preview doesn't display ACF custom fields #224

sebrosen opened this issue Sep 21, 2019 · 12 comments

Comments

@sebrosen
Copy link

When I add a custom field to a post and try to preview it, the custom field is not displaying. This only happens if the post have been published. If the post is just a draft, then the preview work as expected.

This only seems to be an issue if you use the ACF functions get_field or the_field. I tried displaying the custom field using get_post_meta and then the preview worked as expected.

I saw other people have reported the issue and that there's not currently any solution, but I wasn't sure if you were aware that it does indeed work fine if you use get_post_meta

@elliotcondon
Copy link
Contributor

Hi @sebrosen

Thanks for the info. How strange!?
I'm glad to hear that it is possible to preview the meta, so perhaps the issue is with loading the ACF field settings.

I'll perform some investigation shortly and will be in touch with my findings.

@sebrosen
Copy link
Author

Thank you for looking into it!

@sebrosen
Copy link
Author

sebrosen commented Oct 4, 2019

Hey, sorry, I'm curious if you were able to look into this?

@elliotcondon
Copy link
Contributor

Hi @sebrosen

Not yet, but this is near the top of my to-do list :)

@sebrosen
Copy link
Author

sebrosen commented Oct 5, 2019

Fantastic! Keep up the good work :-)

@andreabrunato
Copy link

Hi, i have the same problem. I've found a workaround using this code snippet: WordPress/gutenberg#12617 (comment)

A current active thread, but without solutions: WordPress/gutenberg#16006

I'm using Sage Roots theme, latest Wordpress.

@dmchale
Copy link

dmchale commented Apr 9, 2021

Has this ever been addressed, @elliotcondon ? Knowing sometimes multiple Issues could have been made for the same thing, I didn't know if there were other discussions on this elsewhere that I missed.

I'm running ACF Pro 5.9.5 on WP 5.7 and this still seems to be an issue for me, unfortunately. Client wants to add a new image to their slider (via ACF Repeater) but when previewing the page the code fails the has_rows() check. A get_field() call returns NULL also.

@the20tas
Copy link

the20tas commented May 5, 2021

Hey Elliot, just wondering if a fix might be close for this one? We've noticing it on a new site with latest ACF and WordPress.

@benkelly92
Copy link

Just wanted to add. I have been experiencing this issue with WP 5.7.2 and ACF PRO 5.9.6 (Have also tried 5.9.3) with all other plugins disabled.

Updating fields in the block editor works great. The changes can be seen in the preview, however if the fields are on the post itself, it doesn't work and you need to update the live post or switch to draft and save as a draft to preview.

Hope that can help debugging this issue. As always, massive thankyou for all your hard work.

@stefanfisk
Copy link

stefanfisk commented Feb 9, 2022

Edit: This is somewhat broken, YMMV

I am also encountering this issue with ACF blocks. The workaround from https://support.advancedcustomfields.com/forums/topic/custom-fields-on-post-preview/ seems to work.

@nateplusplus
Copy link

I am also encountering this issue. For clarity: The workaround that @stefanfisk mentioned only ensures that the previously saved values show in the preview, however any edits to the page are not shown on the preview even with the workaround.

@ronilaukkarinen
Copy link

We also spotted this issue, it happens especially for repeater fields. Thanks for the workaround, but need fixing. +1

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

9 participants