-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
status: actionableReady for work to beginReady for work to begin
Description
Description
It looks like ACF fields cannot be queried in previews (at least not the preview data).
My Goal: Be able to access ACF preview data from the API.
This is my query:
query MyQuery2 {
post(id: 125, idType: DATABASE_ID, asPreview: true) {
title
skeleton {
textField
skeleton {
... on SkeletonSkeletonHeadingCopyLayout {
title
}
}
}
}
}
The post's title gets the preview value correctly but both ACF fields are returned with their published values (not the preview).
I've also already tried many variations of this query using revisionOf, or with asPreview: false and accessing by {preview {...}}, or even querying using nodeByUri. Never works.
Steps to reproduce
- I am using WordPress 6.4.2 currently on a localhost from Local by Flywheel PHP version 8.2.8.
- Deactivated all plugins except: WPGraphQL, ACF Pro and WPGraphQL for ACF to avoid any possible plugin conflict.
- Installed the Twenty Twenty Four theme to avoid any possible theme conflict.
- The only modification to the original theme was to add a filter:
add_filter('use_block_editor_for_post_type', '__return_false', 10);to remove gutenberg editor. - Create a new Field Group active in GraphQL with one normal text field and one flexible content field with a text field inside.
- Added the Field Group to pages and posts.
- Created a new post, updated content and then clicked on "Preview changes" button.
- Used the query to view preview content but only the Post's title had a correct preview data. ACF field were still retrieving the published data.
PHP or JSON export of the ACF Field Group(s)
Additional context
No response
WPGraphQL Version
1.19.0
WPGraphQL For ACF Version
2.0.0 (download from WP plugin not github)
ACF (Advanced Custom Fields) Version. Free or Pro?
6.2.5 PRO
WordPress Version
6.4.2
PHP Version
8.2.8
Additional enviornment details
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.
- Yes
- My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.
Metadata
Metadata
Assignees
Labels
status: actionableReady for work to beginReady for work to begin
