register_graphql_field

register_graphql_field( string $type_name, string $field_name, array $config ): void;

Given a Type Name, Field Name, and a $config array, this adds a Field to a registered Type in the TypeRegistry

  • Since: 0.1.0
  • Source File: plugins/wp-graphql/access-functions.php

Parameters

  • $type_name (string): The name of the Type to add the field to
  • $field_name (string): The name of the Field to add to the Type
  • $config (array<string,mixed>): The Type config

Throws

  • \Exception

Recipes

Source

function register_graphql_field( string $type_name, string $field_name, array $config ): void {