Skip to content

How to add support for custom field with array of id's to other posts #2488

Answered by jasonbahl
andyjamesn asked this question in Q&A
Discussion options

You must be logged in to vote

@andyjamesn you've registered your field as 'type' => 'String' which means you're promising to return a string, but the resolver is returning an array.

You can update this to return a list of strings by changing the type to be 'type' => [ 'list_of' => 'String' ]

You might also consider using a connection here and registering a connection between the Post Type and Reporters.

see: register_graphql_connection

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jasonbahl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants