Skip to content

Author field returns null on custom post type query even though CPT is registered with support => 'author' #1476

@Poolshark

Description

@Poolshark

Hi there,

I ran into an issue but im not sure whether it's me or something is wrong with the schema. I have registered a CPT with

$args = [
    'show_in_graphql' => true,
    'graphql_single_name' => 'someCpt',
    'graphql_plural_name' => 'someCpts',
    'graphql_single_type' => 'SomeCpt',
    'graphql_plural_type' => 'SomeCpts',
    'supports' => ['author', 'title', 'custom-fields']
];

When I try to query the CPT including the author data I get NULL as response.

Query

query SomeCptQuery {
 someCpts {
   edges {
     id
     authorDatabaseId
     author {
       node {
         firstName
         lastName
      }
    }
  }
 }
}

Response

{
  "data":  {
    "someCpts": {
      "edges": [
        "node": {
          "id": "SOME_HASH"
          "authorDatabaseId": 1
          "author": null
        }
      ]
    }
  }
}

Did I do something wrong or is it simply not possible to do that?

Thanks!

Metadata

Metadata

Assignees

Labels

needs: author responseAdditional Pending information from the author has been requested from the authortype: questionAn issue that involve inquiries, clarifications, or requests for guidance

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions