Actions
Actions let your code run at specific points in the WPGraphQL request lifecycle without changing the value being processed. Below are the actions WPGraphQL provides for you to hook into.
Debugging and Instrumentation
-
Fire an action AFTER the field resolves
-
Fire an action BEFORE the field resolves
-
graphql_determine_graphql_keysFires after QueryAnalyzer has calculated list/query/model keys for a request.
-
Init the debug logger
Model Layer
-
graphql_after_return_field_from_modelHook that fires after the data is returned for the field
-
graphql_comment_object_mutation_update_additional_dataFires after additional comment mutation data has been updated.
-
Fires after a single term is created or updated via a GraphQL mutation The dynamic portion of the hook name,
$taxonomy->namerefers to the taxonomy of the term being mutated -
Fires after a single term is created or updated via a GraphQL mutation
-
graphql_media_item_mutation_update_additional_dataRun an action after the additional data has been updated.
-
graphql_post_object_mutation_set_object_termsFire an action before setting object terms during a GraphQL Post Object Mutation.
-
graphql_post_object_mutation_update_additional_dataRun an action after the additional data has been updated.
-
Fires an action when a term is updated via a GraphQL Mutation
-
graphql_user_object_mutation_update_additional_dataRun an action after the additional data has been updated.
Request Lifecycle
-
Run an action for each request.
-
Run an action after GraphQL Execution
-
This action runs before execution of a GraphQL request (regardless if it’s a single or batch request)
-
Run an action.
-
Execute batch queries
-
Fire off init action
-
Fires after the mutation payload has been returned from the
mutateAndGetPayloadcallback. -
This action can be hooked to to enable various debug tools, such as enableValidation from the GraphQL Config.
-
graphql_process_http_request_responseRun an action after the HTTP Response is ready to be sent back.
-
Fire an action when the headers are set
-
Run an action after the response has been filtered, as the response is being returned.
-
Run an action when the server config is created.
-
Fires when initializing a GraphQL request from WP-CLI.
-
Action – intentionally with no context – to indicate a GraphQL Request has started.
Schema Registration
-
Fire an action when the Schema is returned
-
Fire an action when the Type Registry is returned
-
graphql_register_initial_typesFire an action as the type registry is initialized.
-
Fire an action as the type registry is initialized.
-
Fire an action as the type registry is initialized.
-
Run an action when the WPConnectionType is instantiating.
-
Run an action when the WPMutationType is instantiating.
-
Run an action when the WPObjectType is instantiating
-
Fires after a WPUnionType has been configured and before registration.
-
Fire an action as the Type registry is being initiated.
Settings and Admin
-
Fires before GraphiQL extensions are enqueued.
-
Fires when admin notices are initialized.
-
graphql_admin_notices_render_noticeFires for each admin notice that is rendered.
-
graphql_admin_notices_render_noticesFires before the admin notices are rendered.
-
Fires the update routine.
-
Fires after all the experiments have been loaded.
-
graphql_experiments_registeredFires after the experiment classes have been registered.
-
Fires before WPGraphQL settings sections and fields are registered.
-
Fires after core WPGraphQL settings have been registered.
-
graphql_settings_enqueue_scriptsFires when WPGraphQL settings assets should be enqueued.
-
Fires after rendering a WPGraphQL settings form section.
-
Fires before rendering a WPGraphQL settings form section.