Skip to content

Registering a field to a Setting Group no longer works #2381

@jasonbahl

Description

@jasonbahl

Problem

Given the following snippet:

add_action( 'graphql_register_types', function() {

  register_graphql_field( 'GeneralSettings', 'myCustomField', [
   'type' => 'String',
   'resolve' => function() {
      return 'my custom field value';
   }
  ]);

});

I should be able to query the following:

{
  generalSettings {
     myCustomField
  }
}

and get the following response:

{
  "generalSettings": {
    "myCustomField": "my custom field value"
  }
}

This works in v 1.6.12 and prior, but no longer works in v1.7+

For example, in v1.6.12 we can see the myCustomField in the Schema under the GeneralSettings Type:

CleanShot 2022-05-16 at 11 56 37

But, in v1.8.1, we can see this field is missing, even with the code snippet still in place:

CleanShot 2022-05-16 at 11 59 36


Expectation

Using the register_graphql_field function, I should be able to register a field to a GraphQL Type that was registered by the register_setting() API.

Metadata

Metadata

Assignees

Labels

impact: medMinor performance improvements, fix broad user base issuesregressionBug that causes a regression to a previously working featuretype: bugIssue that causes incorrect or unexpected behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions