Given a Type Name and Field Name, this removes the field from the TypeRegistry
- $type_name (string): The Type Name
- $field_name (string): The Field Name to remove from the TypeRegistry
Below is an example of removing the
commentCount field from the
Post type. First the comment count can be seen on the Post type in the below GraphiQL example:
Now we can use the
deregister_graphql_field function to remove this field from the Post type.
Now this field is no longer available to be queried and results in a GraphQL error.