Archives: Filters

  • graphql_interface_fields

    Filter all object fields, passing the $typename as a param.

    This is useful when several different types need to be easily filtered at once. . .for example, if ALL types with a field of a certain name needed to be adjusted, or something to that tune.

    apply_filters( 'graphql_interface_fields', array $fields, string $type_name );

    Params

    • $fields (array): The array of fields for the object config
    • $type_name (string): The name of the object type
  • graphql_wp_interface_type_config

    Filter the config of WPInterfaceType

    apply_filters( 'graphql_wp_interface_type_config', array $config, WPInterfaceType $interface_type );

    Params

    • $config (array): Array of configuration options passed to the WPInterfaceType when instantiating a new type
    • $interface_type (WPInterfaceType): The instance of the WPInterfaceType class
  • graphql_interface_resolve_type

    Filter the resolve type method for all interfaces

    apply_filters( 'graphql_interface_resolve_type', mixed $type, mixed $object, WPInterfaceType $interface_type );

    Params

    • $type (mixed): The Type to resolve to, based on the object being resolved
    • $object (mixed): The Object being resolved
    • $interface_type (WPInterfaceType): The WPInterfaceType instance
  • graphql_input_fields

    Filter all object fields, passing the $typename as a param.

    This is useful when several different types need to be easily filtered at once. . .for example, if ALL types with a field of a certain name needed to be adjusted, or something to that tune

    apply_filters( 'graphql_input_fields', array $fields, string $type_name, array $config, TypeRegistry $type_registry );

    Params

    • $fields (array): The array of fields for the object config
    • $type_name (string): The name of the object type
    • $config (array): Array of config values
    • $type_registry (TypeRegistry): The TypeRegistry instance
  • graphql_request_data

    Allow the request data to be filtered. Previously this filter was only applied to non-HTTP requests. Since 0.2.0, we will apply it to all requests.

    This is a great place to hook if you are interested in implementing persisted queries (and ends up being a bit more flexible than graphql-php’s built-in persistentQueryLoader).

    apply_filters( 'graphql_request_data', array $data, array $request_context );

    Params

    • $data (array): An array containing the pieces of the data of the GraphQL request
    • $request_context (array): An array containing the both body and query params
  • graphql_enum_values

    Pass the enum values through a filter

    apply_filters( 'graphql_enum_values', array $values);

    Params

    • $values (array): The array of values to pass through the filter
  • graphql_user_insert_post_args

    Filters the mappings for input to arguments

    apply_filters( 'graphql_user_insert_post_args', array $insert_user_args, array $input, string $mutation_name );

    Params

    • $insert_user_args (array): The arguments to ultimately be passed to the WordPress function
    • $input (array): Input data from the GraphQL mutation
    • $mutation_name (string): What user mutation is being performed for context
  • graphql_user_mutation_input_fields

    Filters all of the fields available for input

    apply_filters( 'graphql_user_mutation_input_fields', array $input_fields );

    Params

    • $input_fields (array): The array of input fields
  • graphql_map_input_fields_to_wp_user_query

    Filter 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.

    apply_filters( 'graphql_map_input_fields_to_wp_user_query', array $query_args, array $where_args, mixed $source, array $all_args, AppContext $context, ResolveInfo $info );

    Params

    • $query_args (array): Array of mapped query args
    • $where_args (array): Array of query “where” args
    • $source (mixed): The query results of the query calling this relation
    • $all_args (array): All of the query arguments (not just the “where” args)
    • $context (AppContext): The AppContext object
    • $info (ResolveInfo): The ResolveInfo object
  • graphql_tracing_response

    Filter the trace

    apply_filters( 'graphql_tracing_response', array $trace, Tracing $tracing );

    Params

    • $trace (array): The trace to return
    • $tracing (Tracing): The Tracing class instance