1

I'm experimenting with Gatsby.

On the WordPress side I've installed the plugin wp-graphql. (I've also installed wp-graphql-acf, because I've got some ACF fields that I want to expose )

I have two CPT's. For both of the CPT's I've passed the following parameters in the register_post_type array:

'show_in_rest'         => true,
'show_in_graphql'      => true,
'graphql_single_name'  => 'album',
'graphql_plural_name'  => 'albums'

I then start 'gatsby develop' and go to the graphiql interface to start looking for data.

In the Explorer I can a toggle with the title allWpAlbum

So: the cpt exists. It is exposed to graphiql. Instances of the CPT exist and are published.

However, I can't figure out to get any actual data. Queries like the following one return empty sets:

query MyQuery {
  allWpAlbum {
    edges {
      node {
        id
      }
    }
  }
 
}

So: how do I actually the posts?

Ferran Buireu
  • 28,630
  • 6
  • 39
  • 67
bob
  • 753
  • 4
  • 15
  • 27
  • Can you share a CodeSandbox? It's difficult to guess configuration issues like this one with the provided details – Ferran Buireu Apr 18 '22 at 08:57
  • @FerranBuireu: I'm afraid I don't really know how codesandbox work. But if the data isn't showing due to a configuration issue, I'd be happy to paste configuration files. Which configs should we be looking at? – bob Apr 18 '22 at 11:28

0 Answers0