-
Notifications
You must be signed in to change notification settings - Fork 466
Description
Description
Querying the name field of a comment author used to return the name set in the comment_author field in the wp_comments database, it no longer does if the comment was created by a logged in user from the WordPress Admin-Panel. Instead, it always returns the name of the user.
I understand that the node returned by CommentToCommenterConnectionEdge can either be a User or a CommentAuthor, but I think if there is a name set in comment_author querying the name field should always return that value.
This seems to be how it used to work, as we’ve been adding a generic team name to our replies to anonymous comments and until recently (probably v1.27.0) got the team name back in the query, not the name of the WordPress user.
Steps to reproduce
- Add a comment in the WordPress Admin Panel
- Change the
comment_authorfield to'Generic Team'by editing the comment in the Admin Panel - Note the Comment’s ID
- In the GraphQL IDE execute the following query:
query {
comment(id: [the ID of the comment], idType: DATABASE_ID) {
author {
node {
name
}
}
}
}The expected result should be the following:
{
"data": {
"comment": {
"author": {
"node": {
"name": "Generic Team"
}
}
}
}
}Instead, the result is:
{
"data": {
"comment": {
"author": {
"node": {
"name": [Your WordPress User First Name + Last Name]
}
}
}
}
}Additional context
I’m quite new to WP GraphQL, so it might very well be that I’m missing something, but the code worked before and only recently stopped working.
Interestingly enough, comments created before the update to v1.27.0 still return the content of comment_author despite the comment having a user_id that isn’t 0.
WPGraphQL Version
1.28.1
WordPress Version
6.6.1
PHP Version
8.3.6
Additional environment details
Frontend is running via Next.js, but the issue can be reproduced in the GraphQL IDE. WordPress is run through Roots Bedrock.
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
Type
Projects
Status