Skip to content

Instantly share code, notes, and snippets.

@betweenbrain
Created October 29, 2019 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betweenbrain/e00ce09b334a75c43572106d6963027d to your computer and use it in GitHub Desktop.
Save betweenbrain/e00ce09b334a75c43572106d6963027d to your computer and use it in GitHub Desktop.
WPGraphQL Hooks and Filters
add_action(
	'graphql_return_response', function( $filtered_response, $response, $schema, $operation, $query, $variables ) {

		return $filtered_response;
	}, 10, 6
);

add_action(
	'do_graphql_request', function( $query, $operation, $variables, $params ) {

	}, 10, 4
);

add_action(
	'graphql_execute', function( $response, $schema, $operation, $query, $variables ) {

		return $response;
	}, 10, 5
);


add_action(
	'graphql_before_resolve_field', function( $source, $args, $context, $info, $field_resolver, $type_name, $field_key, $field ) {

	}, 10, 8
);

add_filter(
	'graphql_resolve_field', function( $result, $source, $args, $context, $info, $type_name, $field_key, $field, $field_resolver ) {

		return $result;
	}, 10, 9
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment