-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-source-wordpress] GraphQL Error Unknown type "acf_post_photo" #5049
Comments
Query in code you linked is different then the one you show in issue. You use inline fragmets in your code - but those are meant for union types and defenitely won't work - you should use same query as You used in GraphiQL (as in same fields) |
But that's what I don't get. In the example source code from [gatsby-source-wordpress] inline fragments are also used. In the documentation for the plugin its being done this exact way for ACF Flexible Content. |
Oh, I didn't catch it is flexible content - so problem here is You use only single type - gatsby will not create Union for single type (and when union is created that's when inline fragments are needed). So if you will have more content of different type in your flexible field (it doesn't have to be in same post) then union will be created and you will need inline fragments. |
Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help! |
When I run
gatsby develop
I get a GraphQL error regarding the ACF fields and on the frontend I get an error message.The shown error message in the terminal console reads
GraphQL Error Unknown type "acf_post_photo".
I started a Gatsby App & WordPress Site from scratch and copied carefully the everything in order. I also changed the acf field names in the backend and in templates/post.js
When I delete all code respective to ACF from templates/post.js the app builds just fine and all regular wordpress content is shown.
The curios thing is, that when I run a query from GraphiQL it successfully pulls all the acf fields and content.
These are all my plugins in WordPress
This is my edited code from templates/post.js
There were already several similar issues, though none brought a solution. Hopefully somebody can help? (Sorry about not keeping it short 🌚)
The text was updated successfully, but these errors were encountered: