Skip to content

Deprecated graphql_data_loaders Hook Causing Warnings #460

@bpkennedy

Description

@bpkennedy

Description

Bug Report: Deprecated graphql_data_loaders Hook Causing Warnings

Environment

  • WPGraphQL Version: 2.3.3 (latest)
  • WPGraphQL for WooCommerce Version: 0.21.2 (latest)
  • WPGraphQL for Gravity Forms Version: 0.13.2 (latest)
  • WordPress Version: 6.x
  • PHP Version: 8.x

Issue Description
The plugin is using the deprecated graphql_data_loaders hook which was deprecated in WPGraphQL 2.3.2 in favor of graphql_data_loader_classes. This causes deprecation warnings to be logged continuously.

Expected Behavior
No deprecation warnings should be generated when using the latest versions of WPGraphQL and the plugin together.

Actual Behavior
Deprecation warnings are continuously logged to debug.log:

[30-Jun-2025 21:02:53 UTC] PHP Deprecated: Hook graphql_data_loaders is deprecated since version 2.3.2! Use graphql_data_loader_classes instead. The graphql_data_loaders filter is deprecated and will be removed in a future version. Instead, use the graphql_data_loader_classes filter to add/change data loader classes before they are instantiated. in /var/www/html/wp-includes/functions.php on line 6121

Root Cause:
For WPGraphQL for WooCommerce:
File: includes/class-core-schema-filters.php, Line 35

add_filter( 'graphql_data_loaders', [ self::class, 'graphql_data_loaders' ], 10, 2 );

For WPGraphQL for Gravity Forms:
File: src/CoreSchemaFilters.php, Line 24

add_filter( 'graphql_data_loaders', [ Factory::class, 'register_loaders' ], 10, 2 );

Suggested Fix
Update the hook registration to use the new graphql_data_loader_classes hook:

WooCommerce:

// Change from:
add_filter( 'graphql_data_loaders', [ self::class, 'graphql_data_loaders' ], 10, 2 );

// To:
add_filter( 'graphql_data_loader_classes', [ self::class, 'graphql_data_loaders' ], 10, 2 );

Gravity Forms:

// Change from:
add_filter( 'graphql_data_loaders', [ Factory::class, 'register_loaders' ], 10, 2 );

// To:
add_filter( 'graphql_data_loader_classes', [ Factory::class, 'register_loaders' ], 10, 2 );

Impact

  • Severity: Low (functionality unaffected)
  • Urgency: Medium (clutters debug logs, will break when hook is removed)
  • Affected Users: All users running WPGraphQL 2.3.3 with debug logging enabled

Additional Notes
The functionality continues to work correctly; this is purely a forward-compatibility issue. However, the deprecated hook may be removed in a future WPGraphQL major version, so updating is recommended.

Steps to reproduce

See above

Additional context

See above

Plugin Version

0.13.2

Gravity Forms Version

2.9.9

WordPress Version

6.8.1

WPGraphQL Version

2.3.3

Additional enviornmental details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for Gravity Forms, WPGraphQL, and WPGraphQL for Gravity Forms

  • Yes
  • My issue is with a specific 3rd-party plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions