Home › Forums › General Issues › Preview solution !
Sorry, but this is not working with current Pro-Version 5.7.6. The get_field
always returns null
when its in preview mode and “draft”. The post type is just “page”, not a custom post type. Its only when the post status is “draft” (“pending” or “publish” is working in preview mode).
Update: This seems to be not an ACF Bug. It comes from another plugin called “ACF User Role Field Setting”. I’ve opened a new topic for that here.
This bug is present in WordPress 5.0.3 with ACF 5.7.11.
Updating to ACF 5.8.0 solves the problem.
Hello,
its not working for WP 5.2.2 and ACF 5.8.1
Any update on this?
Best.
+1 same here
Still not any real solution for this ?
acf Version 5.8.4
wp 5.2.3
Hi All,
This is a known issue in the Gutenberg project, but no solution has yet been announced.
I’m sorry to report that this is not fixable from my end.
Hey guys,
My temporary solution is to use the classic editor plugin.
Now I can preview my changes and they show up.
Hope it helps!
I’m having this issue on a site as well. Not custom fields, on Pages, already using classic editor. Any updates?
It seems to me as more of an ACF issue than Gutenberg’s. Apparently if there’s an existing revision/autosave record in the DB of the post being previewed it will just return false
when you try to retrieve the field using ACF’s functions. This is a workaround I’m currently testing:
function fix_post_id_on_preview($null, $post_id) {
if (is_preview()) {
return get_the_ID();
}
else {
$acf_post_id = isset($post_id->ID) ? $post_id->ID : $post_id;
if (!empty($acf_post_id)) {
return $acf_post_id;
}
else {
return $null;
}
}
}
add_filter( 'acf/pre_load_post_id', 'fix_post_id_on_preview', 10, 2 );
Another workaround would be to just use get_post_meta
instead of ACF’s functions
@camiloaprs solution doesn’t seem to work for fields from option pages.
Any idea on how to solve this?
Well, this just saved my bacon!
Thank you, CamiloAPR
I’m bookmarking this thread for sure!
The topic ‘Preview solution !’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.