AdvancedCustomFields / AdvancedCustomFields/acf
Gutenberg post preview doesn't display ACF custom fields
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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