graphql_request_results

apply_filters( 'graphql_request_results', $response, $this->schema, $operation, $query, $variables, $this, $query_id );

Filter the $response of the GraphQL execution. This allows for the response to be filtered before it’s returned, allowing granular control over the response at the latest point. POSSIBLE USAGE EXAMPLES: This could be used to ensure that certain fields never make it to the response if they match certain criteria, etc. For example, this filter could be used to check if a current user is allowed to see certain things, and if they are not, the $response could be filtered to remove the data they should not be allowed to see. Or, perhaps some systems want the response to always include some additional piece of data in every response, regardless of the request that was sent to it, this could allow for that to be hooked in and included in the $response.

  • Type: filter
  • Group: Request Lifecycle
  • Since: 0.0.5
  • Source File: plugins/wp-graphql/src/Request.php

Parameters

  • $response (mixed|array<string,mixed>|object): The response for your GraphQL query
  • $schema (\WPGraphQL\WPSchema): The schema object for the root request
  • $operation (?string): The name of the operation
  • $query (?string): The query that GraphQL executed
  • $variables (?array<string,mixed>): Variables to passed to your GraphQL query
  • $request (\WPGraphQL\Request): Instance of the Request
  • $query_id (?string): The query id that GraphQL executed

Source

apply_filters( 'graphql_request_results', $response, $this->schema, $operation, $query, $variables, $this, $query_id );

Recipes