Description
When using register_graphql_field(), a DUPLICATE_FIELD error is thrown even if the field being registered is compatible with the existing one.
For example, let's say a NodeWithSeo interface registers the seo: SeoInterface field. I should be able to overwrite PostObject.seo to be type PostObjectSeo implements SeoInterface. However, because at this point in the lifecycle, the interface fields are already merged with the fields in WPObjectType, the blind key-check sees that seo already exists and bails.
Ideally, if the field already exists, the new object type would be compared to see if it is compatible with the interface instead of throwing an error. (However I'm unaware of any internal methods for getting a list of implementing interfaces for a GraphQL object name).
Steps to reproduce
- Register your custom interface, e.g.
SeoInterface
- Register your custom object that implements that interface. e.g.
PostObjectSeo.
- Create a new interface to add a
seo: SeoInterface to all ContentNodes.
- Register a custom field on
PostObject to override the type of your custom field: seo: PostObjectSeo.
- Enable GraphQL Debugging and run the query.

Additional context
- The workaround is manually using the 'graphql_{$type_name}_fields' filter, but that's bad DX.
- This affects the schema usability for both WPGraphQL for Gravity Forms and WPGraphQL for RankMath Seo.
WPGraphQL Version
1.22.1
WordPress Version
6.5.0
PHP Version
8.1.15
Additional environment details
Ubuntu 20.04 ( wsl2 + devilbox).
Please confirm that you have searched existing issues in the repo.
Please confirm that you have disabled ALL plugins except for WPGraphQL.
Description
When using
register_graphql_field(), aDUPLICATE_FIELDerror is thrown even if the field being registered is compatible with the existing one.For example, let's say a
NodeWithSeointerface registers theseo: SeoInterfacefield. I should be able to overwritePostObject.seoto be typePostObjectSeo implements SeoInterface. However, because at this point in the lifecycle, the interface fields are already merged with the fields inWPObjectType, the blind key-check sees thatseoalready exists and bails.Ideally, if the field already exists, the new object type would be compared to see if it is compatible with the interface instead of throwing an error. (However I'm unaware of any internal methods for getting a list of implementing interfaces for a GraphQL object name).
Steps to reproduce
SeoInterfacePostObjectSeo.seo: SeoInterfaceto allContentNodes.PostObjectto override the type of your custom field:seo: PostObjectSeo.Additional context
WPGraphQL Version
1.22.1
WordPress Version
6.5.0
PHP Version
8.1.15
Additional environment details
Ubuntu 20.04 ( wsl2 + devilbox).
Please confirm that you have searched existing issues in the repo.
Please confirm that you have disabled ALL plugins except for WPGraphQL.