WPGraphQL中的帖子列表

问题描述

我正在创建一个新的Gutenberg ACF模块。我希望能够动态提供GraphQL中的Post对象列表,以供Gatsby读取。

这是我的代码,可在wordpress GraphiQL和Gatsby的GraphQL中使用,以返回单个帖子。

Gutenberg阻止代码

enter image description here

Gatsby GraphQL:

enter image description here

但是,如果我将其更改为返回帖子列表,则它在wordpress GraphiQL中确实有效,但在盖茨比的GraphQL中返回空列表。

Gutenberg阻止代码

enter image description here

wordpress GraphiQL:

enter image description here

Gatsby GraphQL:

enter image description here

我正在为盖茨比使用gatsby-source-wordpress-experimental 1.3.8。

我包装Post对象列表错误吗?以前有没有其他人在WP GraphQL中提供过帐类型列表?

解决方法

这是解决此问题的方法:

enter image description here

祝您编程愉快!