graphql_menu_item_connection_restrict_to_locations

apply_filters( 'graphql_menu_item_connection_restrict_to_locations', true, $locations, $args, $this->get_unfiltered_args() );

Filter whether the menu item connection should be restricted to items assigned to a registered menu location. By default, public (unauthenticated) requests are limited to menu items assigned to a menu location. Return false to allow public requests to query menu items belonging to menus that are not assigned to any location (e.g. when using the “Make Menus and Menu Items public” recipe, which also flips the MenuItem Model privacy gate via graphql_data_is_private). An explicit location where arg always restricts to that location and is unaffected by this filter.

  • Type: filter
  • Group: Connections
  • Since: x-release-please-version
  • Source File: plugins/wp-graphql/src/Data/Connection/MenuItemConnectionResolver.php

Parameters

  • $restrict_to_locations (bool): Whether to restrict the connection to assigned menu locations. Default true.
  • $locations (int[]|null): The menu location term IDs the connection is being restricted to, or null when unrestricted (privileged user).
  • $args (array<string,mixed>): The GraphQL args passed to the resolver.
  • $unfiltered_args (array<string,mixed>): Array of arguments input in the field as part of the GraphQL query.

Source

apply_filters( 'graphql_menu_item_connection_restrict_to_locations', true, $locations, $args, $this->get_unfiltered_args() );