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

[gatsby-source-wordpress] ACF data cannot be queried if first post has no fields #2471

Closed
crgeary opened this issue Oct 16, 2017 · 1 comment

Comments

@crgeary
Copy link
Contributor

crgeary commented Oct 16, 2017

If the first post Gatsby queries (for a given post type) does not have ACF data assigned to it (if you have conditional fields, or you install ACF on an existing site), then GraphQL treats every post of that post type as if it has no ACF data (even though they can do). Presumably because it returns false instead of {}

This is what the WP API gives you back when you have no data:

{
    "acf": false,
}

This is what the WP API gives you when you do have data:

{
    "acf": {
        "project_url": "https://..."
    }
}

I spoke to Kyle and his thoughts were:

ok, this fix is easy then, gatsby-source-wordpress should just strip away the acf: false since that's useless to us

But I cannot figure out what I have to change to make this happen unfortunately.


Using:

  • gatsby: ^1.9.36
  • gatsby-source-wordpress: ^2.0.12

Probably related to: #2417 and #2394

@crgeary crgeary changed the title [gatsby-source-wordpress] ACF data cannot be queried [gatsby-source-wordpress] ACF data cannot be queried if first post has no fields Oct 16, 2017
@KyleAMathews
Copy link
Contributor

Add a new function here:

// Normalize data & create nodes

As you can see, there's already a long list of things we do to normalize the data coming from WordPress.

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

No branches or pull requests

2 participants