Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Fix: Internal server error 500 for relationship to non-published post #301

Merged

Conversation

rsm0128
Copy link
Contributor

@rsm0128 rsm0128 commented Nov 10, 2021

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 used WPGraphQL\Model\Model::get_visibility() function to check if the user have the proper permission to read the post.

@jasonbahl jasonbahl merged commit 164f2b3 into wp-graphql:develop Nov 10, 2021
@jasonbahl jasonbahl mentioned this pull request Sep 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relationship field query errors out when Post that it is set to is deleted
2 participants