Skip to content

Avatar URLs are included in responses when Show Avatars setting is disabled #3064

@mindctrl

Description

@mindctrl

Description

When avatar display is disabled in WordPress under Settings > Discussion, WPGraphQL still provides the avatar URL in responses at viewer.avatar.url.

For comparison, the WP REST API does not include the avatar URLs in responses when this setting is disabled.

Screenshot of setting being referenced:
image

Example query:

query NewQuery {
  viewer {
    avatar {
      url
    }
  }
}

Output from example query:

{
  "data": {
    "viewer": {
      "avatar": {
        "url": "http://1.gravatar.com/avatar/729ae85bf62b9917e93538db2f2688ca?s=96&d=mm&r=g"
      }
    }
  }
}

Steps to reproduce

  1. Go to Settings > Discussions in wp-admin
  2. Ensure the "Show Avatars" checkbox is NOT checked and save the settings
  3. Do the above example query
  4. See avatar URLs in response

Additional context

No response

WPGraphQL Version

1.21.0

WordPress Version

6.4.3

PHP Version

8.1.23

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

component: queryRelating to GraphQL Queriesobject type: userRelating to the User Typetype: bugIssue that causes incorrect or unexpected behavior

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions