AdvancedCustomFields / AdvancedCustomFields/acf

Gutenberg post preview doesn't display ACF custom fields

Open
#224 13 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Gutenberg preview with a published post and an ACF custom field, comparing get_field and the_field with get_post_meta. Trace how these functions resolve values during preview requests and identify why published posts differ from drafts. Done means ACF field functions display the custom field in published-post previews without breaking draft previews.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.