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”)