Skip to content
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

Option page ACF fields are null when using Graphiql in Gatsby #384

Open
Mellis84 opened this issue Mar 19, 2024 · 2 comments
Open

Option page ACF fields are null when using Graphiql in Gatsby #384

Mellis84 opened this issue Mar 19, 2024 · 2 comments

Comments

@Mellis84
Copy link

Hi There,

I created some ACF fields for option pages using ACF Pro's option page field group. I was able to view the data in Wordpress, in the GraphiQL IDE, but, trying to do the same in my Gatsby site, using the GraphiQL explorer, the fields return null.

My package.json

    "framer-motion": "^11.0.14",
    "gatsby": "^5.13.3",
    "gatsby-adapter-netlify": "^1.1.3",
    "gatsby-plugin-alias-imports": "^1.0.5",
    "gatsby-plugin-image": "^3.13.1",
    "gatsby-plugin-manifest": "^5.3.1",
    "gatsby-plugin-netlify": "^5.1.1",
    "gatsby-plugin-offline": "^6.3.1",
    "gatsby-plugin-react-helmet": "^6.3.0",
    "gatsby-plugin-sass": "^6.13.1",
    "gatsby-plugin-sharp": "^5.13.1",
    "gatsby-plugin-web-font-loader": "^1.0.4",
    "gatsby-source-filesystem": "^5.13.1",
    "gatsby-source-wordpress": "^7.10.1",
    "gatsby-transformer-sharp": "^5.13.1",
    "html-react-parser": "^5.1.8",
    "lodash": "^4.17.20",
    "postcss": "^8.2.10",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-helmet": "^6.1.0",
    "react-redux": "^9.1.0",
    "tua-body-scroll-lock": "^1.4.1"```

Not sure if this is an issue with the  gatsby-source-wordpress package or wp-graphql-acf plugin.
@jasonbahl
Copy link
Contributor

@Mellis84 when using the GraphiQL IDE in the WordPress admin, can you query the data? if so, then WPGraphQL is working and this is likely an issue with Gatsby.

Also, what version of WPGraphQL for ACF are you using? This repo is for WPGraphQL for ACF v0.6.* and older and the new repo for the re-built plugin that is on WordPress.org and will be maintained and updated going forward is over here: https://github.com/wp-graphql/wpgraphql-acf

@Mellis84
Copy link
Author

Mellis84 commented Mar 27, 2024

Hi @jasonbahl So I figured out to an extent what was going on, I was originally using the new https://github.com/wp-graphql/wpgraphql-acf plugin (Version 2.2.0). Creating ACF flexible content created errors in Gatsby:

Missing onError handler for invocation 'extracting-queries', error was 'Error: Type WpAcfFieldGroup must define one or more fields.

Interface field WpAcfFlexibleContentAcfBlocks_Layout.fieldGroupName expected but WpAcfFlexibleContentAcfBlocksRichTextLayout_Fields does
not provide it.

If I downgrade to this wp-graphql-acf version, acf flexible content works fine, but options pages don't show in the schema, looks like you have to manually add them in the functions.php rather than switching the show in graphql button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants