WPGraphQL follows WordPress access control rights, and only exposes data publicly that WordPress already exposes publicly. Users that have published posts are considered public entities in WordPress. Users that have not published posts are considered private and will not be included in public GraphQL requests, but will be included in GraphQL requests made by authenticated users with proper capabilities to see the users.
Issue
The issue is that we are receiving
null
asauthor
on comments from users without published post. This is related to https://github.com/WebDevStudios/nextjs-wordpress-starter/issues/233Feature Description
Per WP GraphQL's docs
Reference: https://www.wpgraphql.com/docs/users/
This PR make all users public.
Screenshots
How comments look like in the backend![Screen Shot 2021-03-12 at 9 37 00 PM](https://user-images.githubusercontent.com/5747475/110947620-5aa65b80-837b-11eb-9eef-68f7369c7a7e.png)
WP GraphQL response prior to this PR![Screen Shot 2021-03-12 at 9 39 56 PM](https://user-images.githubusercontent.com/5747475/110947887-ad801300-837b-11eb-9e02-95a36a095de5.png)
Notice that
null
is returned instead of John DoeWP GraphQL with this PR code changes![Screen Shot 2021-03-12 at 9 45 20 PM](https://user-images.githubusercontent.com/5747475/110948525-6cd4c980-837c-11eb-9b49-6f7c1274d177.png)
Steps To Verify Feature
author
instead ofnull
.Note: Do not use the GraphiQL IDE on WP Dashboard since it will be authenticated.