graphql_single_name; }, $post_types_with_revision_support ); register_graphql_union_type( 'ContentRevisionUnion', [ 'typeNames' => $type_names, 'description' => __( 'A union of Content Node Types that support revisions', 'wp-graphql' ), 'resolveType' => function ( Post $object ) use ( $type_registry ) { $type = 'Post'; $parent = get_post( (int) $object->parentDatabaseId ); if ( ! empty( $parent ) && isset( $parent->post_type ) ) { $parent_post_type_object = get_post_type_object( $parent->post_type ); if ( isset( $parent_post_type_object->graphql_single_name ) ) { $type = $type_registry->get_type( $parent_post_type_object->graphql_single_name ); } } return ! empty( $type ) ? $type : null; }, ] ); } } }