本文介绍了gatsby-source-graphql + ACF字段未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道为什么使用gatsby-source-graphql插件无法在我的gatsby应用程序中显示我的ACF字段?当我使用WP插件WP GraphiQL时,会显示我的ACF字段,但是当我运行gatsby应用程序时却不会显示.我只能使用gatsby-source-wordpress导入ACF字段吗???其他一切似乎都出现了.我使用的自定义帖子类型没有问题,但是ACF字段是问题所在.任何帮助都将是惊人的,谢谢,斯宾塞

I'm wondering why my ACF fields are not showing up in my gatsby app using the gatsby-source-graphql plugin? My ACF fields show up when I use the WP plugin: WP GraphiQL, but not when I run my gatsby app. Can I only import ACF fields using gatsby-source-wordpress??? Everything else seems to show up. I have a custom post type that I'm using no problem, but ACF fields are the issue. Any help would be amazing, Thanks,Spencer

它们显示在WP后端中:

They show up in WP backend:

但是当盖茨比(Gatsby)运行时不显示:

But do not show up when Gatsby runs:

这是我的盖茨比配置中的内容:

Here is whats in my Gatsby config:

{
      resolve: `gatsby-source-graphql`,
      options: {
        // This type will contain remote schema Query type
        typeName: `WPGraphQL`,
        // This is field under which it's accessible
        fieldName: `wpgraphql`,
        // Url to query from
        url: `http://wpgraphql.local/graphql`,
      },
    },

推荐答案

看起来我要做的就是删除Gatsby中的.cache目录并重建!

Looks like all I had to do was delete the .cache directory in Gatsby and rebuild!

这篇关于gatsby-source-graphql + ACF字段未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 03:16