Advanced Custom Fields - Type "User" not retrieved properly in gatsby-source-wordpress
See original GitHub issuePreliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
The issues happened when I use the Advanced Custom Fields (ACF) with GraphQL in wordpress.
If the ACF Fields type is USER
, it is able to retrieve in the GraphQL in wordpress as the screenshot shown below.
However, when it reach to gatsby source, the graphql cannot get the value of the user.
This issue only occurred whenever the ACF field type is USER
. If the field type is other (eg.: Text), the data can be retrieved correctly.
Reproduction Link
can’t share the repo sorry
Steps to Reproduce
- Install plugins in wordpress and set up wordpress as source with gatsby-source-wordpress
- Create a new field group on pages with ACF and add a “User” field with type “USER” that links to a page
- Run http://localhost:8000/__graphql in the fresh Gastby site and run the query for the user field.
Expected Result
The user field is correctly reflected in the gatsby-source-wordpress GraphQL like the Wordpress GraphqQL.
Actual Result
The user field returns null in the gatsby-source-wordpress GraphQL
Environment
System:
OS: Windows 10 10.0.19043
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 14.17.1 - C:\Program Files\nodejs\node.EXE
npm: 7.19.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 94.0.4606.81
Edge: Spartan (44.19041.1266.0), Chromium (94.0.992.50)
npmPackages:
gatsby: ^3.7.0 => 3.9.1
gatsby-awesome-pagination: ^0.3.8 => 0.3.8
gatsby-plugin-advanced-sitemap: ^2.0.0 => 2.0.0
gatsby-plugin-emotion: ^6.9.0 => 6.9.0
gatsby-plugin-google-tagmanager: ^3.12.0 => 3.12.0
gatsby-plugin-image: ^1.12.0 => 1.12.0
gatsby-plugin-layout: ^2.7.0 => 2.9.0
gatsby-plugin-postcss: ^4.9.0 => 4.9.0
gatsby-plugin-react-helmet: ^4.12.0 => 4.12.0
gatsby-plugin-robots-txt: ^1.6.10 => 1.6.10
gatsby-plugin-sharp: ^3.12.0 => 3.12.0
gatsby-source-graphql: ^3.9.0 => 3.9.0
gatsby-source-shopify: ^4.7.0 => 4.7.1
gatsby-source-wordpress: ^5.7.0 => 5.9.1
gatsby-transformer-sharp: ^3.12.0 => 3.12.0
npmGlobalPackages:
gatsby-cli: 3.13.0
Config Flags
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Advanced Custom Fields are detected on normal WP Post but ...
In my project I have multiple content types: default ones: posts and pages programs (custom content type created with register_post_type) ...
Read more >Known Issues - ACF
Welcome to the known issues guide for the Advanced Custom Fields plugin. This guide contains information and solutions for common problems found in...
Read more >How to use gatsby-source-wordpress and add ACF to Menu's ...
Is it possible to query ACF added to Menu's and Menu Items? I was struggling with this specific use case of querying data...
Read more >gatsby-source-wordpress
Any new entity should be pulled as long as the IDs are correct. ACF Entities (Advanced Custom Fields); Custom Post Types (any type...
Read more >Using New Gatsby Source WordPress Plugin - CSS-Tricks
This article is not a step-by-step guide on how to use Gatsby Source ... and one that uses WordPress with the Advanced Custom...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@awelles sorry for the late reply but I’ve used the solution provided and it seems working as what I wish for. Thanks a lot!
@chieyang96 have a look here. When querying from gatsby you’re unauthorized w/ wordpress and so lack the ‘list_users’ capability. This blocks the user’s from showing. You can add PHP to your wordpress install to bypass this:
https://www.wpgraphql.com/recipes/make-all-users-public/
Side note: WPGraphql allows you to see Users when unauthorized, just not ACF User fields. Which doesn’t seem quite right… Something to bring up with ‘WPGraphQl for ACF’ devs perhaps.