Link to WPGraphQL on Github
Link to WPGraphQL on WordPress.org


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


File: access-functions.php


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:

Example showing the commentCount field is available on the Post type

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.