From 56cd1d369e99a710afc7601be2817e3e76e94ccb Mon Sep 17 00:00:00 2001 From: rsm0128 Date: Wed, 10 Nov 2021 15:50:37 +0900 Subject: [PATCH] fix #300, #85, #100 --- src/class-config.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/class-config.php b/src/class-config.php index 927f2b3..08c3c4b 100644 --- a/src/class-config.php +++ b/src/class-config.php @@ -689,12 +689,14 @@ protected function register_graphql_field( string $type_name, string $field_name $post_object = get_post( $post_id ); if ( $post_object instanceof \WP_Post ) { $post_model = new Post( $post_object ); - $relationship[] = $post_model; + if ( 'private' != $post_model->get_visibility() ) { + $relationship[] = $post_model; + } } } } - return isset( $value ) ? $relationship : null; + return empty( $relationship ) ? null : $relationship; }, ];