If non-published post is set for relationship field, it causes 500 internal server error when users without role to see the post try to fetch the field.
In the PR #286, @matt-antone used a condition check $post_object->status === 'publish' to fix this issue.
Instead of that, in this PR, I used WPGraphQL\Model\Model::get_visibility() function to check if the user have the proper permission to read the post.
This PR fixes #300, #85, #100
If non-published post is set for relationship field, it causes 500 internal server error when users without role to see the post try to fetch the field.
In the PR #286, @matt-antone used a condition check
$post_object->status === 'publish'
to fix this issue. Instead of that, in this PR, I usedWPGraphQL\Model\Model::get_visibility()
function to check if the user have the proper permission to read the post.