graphql_query_depth_max

apply_filters( 'graphql_query_depth_max', $max_depth );

Filters the max query depth allowed for the current request. The value passed in comes from the settings: the Max Depth setting when Query Depth Limiting is enabled, or 0 when it’s disabled. Return 0 to allow any depth, or a positive integer to limit it, which also applies the limit when the setting is disabled. A non-numeric return value is ignored and the value from the settings is used. Operations that only query introspection (__schema, __type) are never limited. Use this to give trusted users a different limit than everyone else. Base that decision on a capability (for example current_user_can( 'manage_options' )), not only on whether the user is logged in, since sites with open registration let anyone create an account.

  • Type: filter
  • Group: Request Lifecycle
  • Since: 2.24.0
  • Source File: plugins/wp-graphql/src/Server/ValidationRules/QueryDepth.php

Parameters

  • $max_depth (int): The max query depth. 0 means no limit.

Source

apply_filters( 'graphql_query_depth_max', $max_depth );