Archives: Filters

  • graphql_model_field_capability

    Capability to check required for the field

    apply_filters( 'graphql_model_field_capability', string $capability, string $key, string $
    model_name, mixed $data, string $visibility, null|int $owner, WP_User $current_user );

    Params

    • $capability (string): The capability to check against to return the field
    • $key (string): The name of the field on the type
    • $model_name (string): Name of the model the filter is currently being executed in
    • $data (mixed): The un-modeled incoming data
    • $owner (null|int): The user ID for the owner of this piece of data
    • $current_user (WP_User): The current user for the session
  • graphql_allowed_fields_on_restricted_type

    Filter for the allowed restricted fields

    apply_filters( 'graphql_allowed_fields_on_restricted_type', $allowed_restricted_fields, $model_name, $data, $visibility, $owner, $current_user );

    Params

    • $allowed_restricted_fields (array): The fields to allow when the data is designated as restricted to the current user
    • $model_name (string): Name of the model the filter is currently being executed in
    • $data (mixed): The un-modeled incoming data
    • $visibility (string|null): The visibility that has currently been set for the data at this point
    • $owner (null|int): The user ID for the owner of this piece of data
    • $current_user (WP_User): The current user for the session
  • graphql_object_visibility

    Filter the visibility name to be returned

    apply_filters( 'graphql_object_visibility', string $visibility, string $model_name, mixed $data, int $owner, WP_User $current_user );

    Params

    • $visibility (string|null): The visibility that has currently been set for the data at this point
    • $model_name (string): Name of the model the filter is currently being executed in
    • $data (mixed): The un-modeled incoming data
    • $owner (int|null): The user ID for the owner of this piece of data
    • $current_user (WP_User): The current user for the session
  • graphql_data_is_private

    Filter to determine if the data should be considered private or not

    apply_filters( 'graphql_data_is_private', bool $is_private, string $model_name, mixed $data, string $visibility, int $owner, WP_User $current_user );

    Params

    • $is_private (bool): If the data is private
    • $model_name (string): Name of the model the filter is currently being executed in
    • $data (mixed): The un-modeled incoming data
    • $visibility (string|null): The visibility that has currently been set for the data at this point
    • $owner (null|int): The user ID for the owner of this piece of data
    • $current_user (WP_User): The current user for the session
  • graphql_restricted_data_cap

    Filter for the capability to check against for restricted data

    apply_filters( 'graphql_restricted_data_cap', string $restricted_cap, string $model_name, mixed $data, string $visibility, int $owner, WP_User $current_user );

    Params

    • $restricted_cap (string): The capability to check against
    • $model_name (string): Name of the model the filter is currently being executed in
    • $data (mixed): The un-modeled incoming data
    • $visibility (string|null): The visibility that has currently been set for the data at this point
    • $owner (null|int): The user ID for the owner of this piece of data
    • $current_user (WP_User): The current user for the session
  • graphql_resolve_menu_item

    Allow users to override how nav menu items are resolved. This is useful since we often add taxonomy terms to menus but would prefer to represent the menu item in other ways, e.g., a linked post object (or vice-versa).

    apply_filters( 'graphql_resolve_menu_item', mixed $resolved_object, array $args, AppContext $context, ResolveInfo $info, int $object_id, string $object_type );

    Params

    • $resolved_object (WP_Post|WP_Term): Post or term connected to MenuItem
    • $args (array): Array of arguments input in the field as part of the GraphQL query
    • $context (AppContext): Object containing app context that gets passed down the resolve tree
    • $info (ResolveInfo) Info about fields passed down the resolve tree
    • $object_id (int): Post or term ID of connected object
    • $object_type (string): Type of connected object (“post_type” or “taxonomy”)
  • graphql_media_item_insert_post_args

    Filter the $insert_post_args

    apply_filters( 'graphql_media_item_insert_post_args', array $insert_post_args, array $input, WP_Post_Type $post_type_object, string $mutation );

    Params

    • $insert_post_args (array): The array of $input_post_args that will be passed to wp_insert_attachment
    • $input (array): The data that was entered as input for the mutation
    • $post_type_object (WP_Post_Type): The post_type_object that the mutation is affecting
    • $mutation (string): The type of mutation being performed (create, update, delete)
  • graphql_field_resolver_auth_error_message

    Filter the auth error

    apply_filters( 'graphql_field_resolver_auth_error_message', string $default_auth_error_message, GraphQL\Type\Definition\FieldDefinition $field );

    Params

    • $default_auth_error_message (string): The default auth error message
    • $field (GraphQL\Type\Definition\FieldDefinition): The field definition

  • graphql_resolve_field

    Fire an action before the field resolves

    apply_filters( 'graphql_resolve_field', mixed $result, mixed $source, array $args, AppContext $context, ResolveInfo $info, string $type_name, string $field_key, FieldDefinition $field, mixed $field_resolver );

    Params

    • $result (mixed): The result of the field resolution
    • $source (mixed): The source passed down the Resolve Tree
    • $args (array): The args for the field
    • $context (AppContext): The AppContext passed down the ResolveTree
    • $info (ResolveInfo): The ResolveInfo passed down the ResolveTree
    • $type_name (string): The name of the type the fields belong to
    • $field_key (string): The name of the field
    • $field (FieldDefinition): The Field Definition for the resolving field
    • $field_resolver (mixed): The default field resolver
  • graphql_pre_resolve_field

    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. This filter can be used to implement field level caches or for efficiently hiding data by returning null.

    apply_filters( 'graphql_pre_resolve_field', mixed $nil, mixed $source, array $args, AppContext $context, ResolveInfo $info, string $type_name, string $field_key, FieldDefinition $field, mixed $field_resolver );

    Params

    • $nil (mixed): Unique nil value
    • $source (mixed): The source passed down the Resolve Tree
    • $args (array): The args for the field
    • $context (AppContext): The AppContext passed down the ResolveTree
    • $info (ResolveInfo): The ResolveInfo passed down the ResolveTree
    • $type_name (string): The name of the type the fields belong to
    • $field_key (string): The name of the field
    • $field (FieldDefinition): The Field Definition for the resolving field
    • $field_resolver (mixed): The default field resolver