Filters
Filters let your code modify a value as it passes through WPGraphQL — the schema, a query, a response, and more. Below are the filters WPGraphQL provides for you to hook into.
Authentication and Authorization
-
graphql_authentication_error_status_codeFilter the HTTP status code returned for authentication errors.
-
If false, there are no authentication errors.
-
Allow plugins to prevent the downgrade via the graphql_authentication_errors filter.
-
graphql_cookie_auth_require_nonceFilter whether to require a nonce for cookie-based authentication.
-
graphql_field_resolver_auth_error_messageFilters the default authorization error message for field resolvers.
-
Allows overriding the default graphql_restrict_endpoint behavior.
-
graphql_require_authentication_allowed_fieldsFilters the allowed root fields
Connections
-
Filters the post statuses the current user is allowed to query in this connection.
-
graphql_comment_connection_argsFilters the GraphQL args before they are used in get_query_args().
-
graphql_comment_connection_query_argsFilters the query args used by the connection.
-
Filter the connection.
-
Filters the GraphQL args before they are used in get_query_args().
-
graphql_connection_default_query_amountFilters the default query amount for a connection, if no
firstorlastGraphQL argument is supplied. -
Filter the edge within the connection.
-
Filters the edges in the connection.
-
Filter the connection IDs
-
graphql_connection_is_valid_modelFilters whether or not the model is valid.
-
graphql_connection_loader_nameFilters the loader name.
-
graphql_connection_max_query_amountFilter the maximum number of posts per page that should be queried.
-
Set the items.
-
Filter the pageInfo that is returned to the connection.
-
graphql_connection_pre_get_queryWhen this filter returns anything but null, it will be used as the resolved query, and the default query execution will be skipped.
-
graphql_connection_pre_should_executeFilters whether or not the query should execute, BEFORE any data is fetched or altered.
-
Set the query for the resolver, for use as reference in filters, etc Filter the query.
-
Filters the query args before they are used in the query.
-
graphql_connection_query_classFilters the
$query_classthat will be used to execute the query. -
graphql_connection_should_executeCheck if the connection should execute.
-
Filters the field used for ordering when cursors are used for pagination
-
graphql_map_input_fields_to_get_termsFilter the input fields This allows plugins/themes to hook in and alter what $args should be allowed to be passed from a GraphQL Query to the get_terms query
-
graphql_map_input_fields_to_wp_comment_queryFilter the input fields This allows plugins/themes to hook in and alter what $args should be allowed to be passed from a GraphQL Query to the get_terms query
-
graphql_map_input_fields_to_wp_queryFilter the input fields This allows plugins/themes to hook in and alter what $args should be allowed to be passed from a GraphQL Query to the WP_Query
-
graphql_map_input_fields_to_wp_user_queryFilter the input fields This allows plugins/themes to hook in and alter what $args should be allowed to be passed from a GraphQL Query to the WP_User_Query
-
graphql_menu_item_connection_argsFilters the GraphQL args before they are used in get_query_args().
-
graphql_menu_item_connection_restrict_to_locationsFilter whether the menu item connection should be restricted to items assigned to a registered menu location.
-
graphql_post_object_connection_argsFilters the GraphQL args before they are used in get_query_args().
-
graphql_post_object_connection_query_argsFilter the $query args to allow folks to customize queries programmatically
-
graphql_post_object_cursor_meta_keyAllow filtering the meta key used for cursor based pagination
-
graphql_pre_comment_cursor_nodeIf pre-hooked, return filtered node.
-
If pre-hooked, return filtered node.
-
graphql_pre_resolve_menu_item_connected_nodeWhen this filter returns anything other than null it will be used as the resolved connection for the menu item’s connected node, short-circuiting the default resolution.
-
If pre-hooked, return filtered node.
-
If pre-hooked, return filtered node.
-
graphql_pre_wp_comments_query_cursor_pagination_supportIf pre-filter hooked, return $pre_pieces.
-
graphql_pre_wp_query_cursor_pagination_stabilityIf pre-filter hooked, return $pre_orderby.
-
graphql_pre_wp_query_cursor_pagination_supportIf pre-filter hooked, return $pre_where.
-
graphql_pre_wp_term_query_cursor_pagination_supportIf pre-filter hooked, return $pre_pieces.
-
graphql_pre_wp_user_query_cursor_pagination_stabilityIf pre-filter hooked, return $pre_orderby.
-
graphql_pre_wp_user_query_cursor_pagination_supportIf pre-filter hooked, return $pre_where.
-
graphql_term_object_connection_argsFilters the GraphQL args before they are used in get_query_args().
-
graphql_term_object_connection_query_argsFilters the query args used by the connection.
Debugging and Instrumentation
-
graphql_cache_collection_get_list_typesFilters list type cache keys derived by QueryAnalyzer.
-
graphql_cache_collection_get_query_modelsFilters query model cache keys derived by QueryAnalyzer.
-
graphql_cache_collection_get_query_typesFilters query type cache keys derived by QueryAnalyzer.
-
Filters whether GraphQL debug mode is enabled.
-
Return the filtered debug log
-
Filter the log entry for the debug log
-
Filters whether GraphQL Debug is enabled enabled.
-
Filter the field definition
-
graphql_pre_query_analyzer_get_list_typesFilters list types before QueryAnalyzer derives them from the AST.
-
graphql_pre_query_analyzer_get_modelsFilters model identifiers before QueryAnalyzer derives them from the AST.
-
graphql_pre_query_analyzer_get_query_typesFilters query types before QueryAnalyzer derives them from the AST.
-
When this filter return anything other than the $nil it will be used as the resolved value and the execution of the actual resolved is skipped.
-
graphql_query_analyzer_get_headersFilters GraphQL response headers after query analyzer headers are appended.
-
graphql_query_analyzer_get_runtime_nodesFilters runtime node identifiers captured while resolving a GraphQL request.
-
graphql_query_analyzer_graphql_keysFilters the assembled query analyzer keys before they are returned.
-
graphql_query_analyzer_header_length_limitMany clients have an 8k (8192 characters) header length cap.
-
graphql_query_analyzer_runtime_nodeFilter the node ID before returning to the list of resolved nodes
-
Filter a single saved query row after default normalization.
-
Fire an action before the field resolves
-
graphql_should_analyze_queriesFilters whether to analyze queries for all GraphQL requests.
-
Filters whether to analyze queries or for a specific GraphQL request.
-
graphql_should_show_query_analyzer_in_extensionsFilters whether query analyzer details should be included in response extensions.
-
Filter the trace
-
Filter the trace
-
graphql_user_can_see_query_logsFilter whether the logs can be seen in the request results or not
-
graphql_user_can_see_trace_dataFilter whether the logs can be seen in the request results or not
Model Layer
-
graphql_comment_insert_post_argsFilter the $insert_post_args
-
Filter to determine if the data should be considered private or not
-
Use this filter to retrieving cached data objects from third-party caching system.
-
Filter the model before returning.
-
graphql_dataloader_pre_get_modelThis filter allows the model generated by the DataLoader to be filtered.
-
Use this filter to store entry in a third-party caching system.
-
graphql_html_entity_decoding_enabledDetermine whether html_entity_decode should be applied to the string
-
graphql_media_item_create_allowed_protocolsFilter the allowed protocols for the mutation
-
graphql_media_item_insert_post_argsFilter the $insert_post_args
-
graphql_model_field_capabilityCapability to check required for the field
-
Filter the array of fields for the Model before the object is hydrated with it
-
Filter the visibility name to be returned
-
graphql_post_object_create_default_post_statusFilter the default post status to use when the post is initially created.
-
graphql_post_object_create_should_set_intended_post_statusDetermine whether the intended status should be set or not.
-
graphql_post_object_insert_post_argsFilter the $insert_post_args
-
graphql_post_object_mutations_allow_term_creationFilter whether to allow terms to be created during a post mutation.
-
graphql_pre_model_data_is_privateFilter to short circuit default is_private check for the model.
-
graphql_pre_return_field_from_modelFilter to short circuit the callback for any field on a type.
-
graphql_resolve_revision_meta_from_parentFilters whether to resolve revision metadata from the parent node by default.
-
Filter for the capability to check against for restricted data
-
graphql_return_field_from_modelFilter the data returned by the default callback for the field
-
graphql_term_object_insert_term_argsFilter the $insert_args
-
Filters the mappings for input to arguments
-
graphql_user_mutation_input_fieldsFilters all of the fields available for input
Request Lifecycle
-
graphql_access_control_allow_headersFiltered list of access control headers.
-
Filters hostnames treated as belonging to this WordPress install when resolving node URIs.
-
This filters the config for the AppContext.
-
Filter to change the data loader classes.
-
Allow the query string to be determined by a filter.
-
graphql_http_request_response_errorsFilter thrown GraphQL errors
-
graphql_invalid_content_type_status_codeFilter the status code to return when the content type is invalid
-
graphql_is_batch_queries_enabledFilter whether batch queries are supported or not
-
graphql_is_graphql_http_requestFilter whether the request is a GraphQL HTTP Request.
-
graphql_is_valid_http_content_typeAllow graphql to validate custom content types for HTTP POST requests
-
Filters the mutation input before it’s passed to the
mutateAndGetPayloadcallback. -
Filters the payload returned from the default mutateAndGetPayload callback.
-
This filter provides a fallback for resolving nodes that were unable to be resolved by NodeResolver::resolve_uri.
-
graphql_pre_is_graphql_http_requestFilter whether the request is a GraphQL HTTP Request.
-
graphql_pre_mutate_and_get_payloadFilter to short circuit the mutateAndGetPayload callback.
-
When this filter return anything other than null, it will be used as a resolved node and the execution will be skipped.
-
graphql_query_id_hash_algorithmFilter the hash algorithm to allow different algorithms.
-
Filters normalized GraphQL request data before GET requests are parsed.
-
Filters normalized GraphQL request data before POST requests are parsed.
-
Filter the $response of the GraphQL execution.
-
Add a filter to allow externally registered node types to return the proper type based on the node_object that’s returned
-
When this filter return anything other than null, it will be used as a resolved node and the execution will be skipped.
-
graphql_resolve_uri_query_classFilter the query class used to resolve the URI.
-
graphql_response_headers_to_sendFilter the $headers to send
-
Filter the $status_code before setting the headers
-
Return the filtered root value
-
Filters whether no-cache headers should be sent on the GraphQL HTTP response.
-
Return the validation rules to use in the request
-
Filter this to be anything other than null to short-circuit the request.
-
Filter this to be anything other than null to short-circuit HTTP execution.
Schema Registration
-
Filters scalar type configuration before the scalar is registered.
-
Filter all object fields, passing the $typename as a param This is useful when several different types need to be easily filtered at once.
-
Filter the list of GraphQL connections to excluded from the registry.
-
Filter the list of GraphQL mutations to excluded from the registry.
-
Filter the list of GraphQL types to exclude from the schema.
-
Filter the type before it is loaded into the registry.
-
Filter all object fields, passing the $typename as a param This is useful when several different types need to be easily filtered at once.
-
Filter all interface fields, passing the $typename as a param This is useful when several different types need to be easily filtered at once.
-
graphql_interface_resolve_typeFilter the resolve type method for all interfaces
-
Filter the keys that are prepared for introspection.
-
Filter all object fields, passing the $typename as a param This is useful when several different types need to be easily filtered at once.
-
graphql_post_entities_allowed_post_typesPass through a filter to allow the post_types to be modified.
-
Filter to manually format a GraphQL name according to custom rules.
-
Filter the Schema
-
Generate & Filter the schema.
-
Set the $filterable_config as the $config that was passed to the WPSchema when instantiated
-
graphql_term_entities_allowed_taxonomiesPass through a filter to allow the taxonomies to be modified.
-
Filters the interfaces applied to an object type
-
Filters the GraphQL type name used during enum type construction.
-
Filters the GraphQL type name before the input type is registered.
-
Filters the GraphQL type name before the interface type is registered.
-
Filters the GraphQL type name before the object type is registered.
-
Filters the GraphQL type name used during scalar type construction.
-
Filters the GraphQL type name used during type construction.
-
Generate & Filter the schema.
-
Filters the possible GraphQL object types for the union.
-
Filters the resolved GraphQL object type for a union value.
-
graphql_wp_connection_type_configFilter the config of WPConnectionType
-
graphql_wp_interface_type_configFilter the config of WPInterfaceType
-
graphql_wp_mutation_type_configFilter the config of WPMutationType
-
Filter the config of WPObjectType
-
Filter the config of WPUnionType
-
register_graphql_post_type_argsFilters the graphql args set on a post type
-
register_graphql_taxonomy_argsFilters the graphql args set on a taxonomy
Settings and Admin
-
Pass the notice through a filter before registering it
-
graphql_admin_notices_is_allowed_admin_pageFilter to determine if the current admin page is within the scope of the plugin’s own pages.
-
graphql_allowed_setting_groupsFilter the $allowed_settings to allow some to be enabled or disabled from showing in the GraphQL Schema.
-
graphql_allowed_settings_by_groupFilter the $allowed_settings_by_group to allow enabling or disabling groups in the GraphQL Schema.
-
Filters whether the embedded GraphiQL IDE should be enabled.
-
Filter the configured endpoint path for WPGraphQL.
-
Filter the relative endpoint path where GraphQL can be accessed.
-
graphql_experimental_features_capFilters the capability required to turn experimental features on and off.
-
graphql_experimental_features_overrideFilters global experimental feature overrides.
-
graphql_experiments_registered_classesFilters the list of registered experiment classes.
-
Filters the list of plugins that use WPGraphQL as a dependency.
-
Filter the list of extensions, allowing other plugins to add or remove extensions.
-
graphql_get_possible_dependentsFilters the list of plugins that use WPGraphQL as a dependency.
-
graphql_get_setting_section_field_valueFilter the value before returning it
-
graphql_get_setting_section_fieldsFilter the section fields
-
Filters the rendered GraphiQL admin page markup.
-
Filter the setting field config
-
Filters the WPGraphQL settings sections.
-
Filters the WPGraphQL settings sections.
-
graphql_should_show_experiments_in_extensionsFilter whether experiments should be shown in GraphQL response extensions.
-
Filters whether WPGraphQL admin pages should be visible.
-
Filters the experiment configuration.
-
Filters whether the experiment is active.
-
wpgraphql_enable_major_autoupdatesFilter whether to allow major autoupdates.
-
wpgraphql_enable_untested_autoupdatesFilter whether to allow autoupdates with untested plugins.
-
wpgraphql_experimental_features_enabledFilter whether WPGraphQL experimental features should be enabled.
-
wpgraphql_untested_release_typeFilter the release type to use when checking for untested plugins.