Skip to content

MediaItemSizeEnum becomes empty when intermediate image sizes are disabled → schema invalid #3432

@tloureiro

Description

@tloureiro

Description

When WordPress runs with all intermediate image sizes disabled (policy on WordPress VIP), WPGraphQL exposes MediaItemSizeEnum with zero values. This produces an invalid GraphQL schema and breaks tools that consume introspection (e.g., graphql-codegen) with:
Enum type MediaItemSizeEnum must define one or more values.
Older WPGraphQL bundled with VIP included fallbacks so the enum wasn’t empty; newer standalone builds appear to have removed that behavior.

Steps to reproduce

Run WP with no intermediate sizes (e.g., remove/disable all registered sizes so get_intermediate_image_sizes() returns []). On VIP this is default policy.

Install/activate standalone WPGraphQL (recent release).

Introspect schema or hit /graphql and inspect MediaItemSizeEnum.

Run any codegen/validation on the schema.

Additional context

No response

WPGraphQL Version

2.3.6

WordPress Version

6.8.3

PHP Version

8.2

Additional environment 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 WPGraphQL.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.

Metadata

Metadata

Assignees

Labels

impact: highUnblocks new use cases, substantial improvement to existing feature, fixes a major bugtype: bugIssue that causes incorrect or unexpected behavior

Type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions