1
votes

I create a new field in Custom Fields and give it a location, like this:

enter image description here

After that I activate the Show In GraphQL button and set acf name:

enter image description here

Now, I'm trying to make a query for acf globalOptions in wp-graphql and it gives me an error. Moreover, I can't find globalOptions either in suggestions or in the schema.

GraphiQL-IDE: playground

Docs:

schema

How could I fix this problem?

Thanks in advance.

1
without location? - xadm
what do you mean 'without location'? Should I delete or choose something different? - Daniel Barbakadze
you used this term - xadm
I used it because of the pic, I mean Rules that define where to show selected acf - Daniel Barbakadze
how it (location) is (can be) related to graphql API ? - xadm

1 Answers

2
votes

The problem was in a file functions.php:

it was like:

acf_add_options_page(array(
    'page_title' => __('Global Options'),
    'menu_title' => __('Global Options'),
    'autoload' => true,
));

But it should be like:

acf_add_options_page(array(
    'page_title' => __('Global Options'),
    'menu_title' => __('Global Options'),
    'autoload' => true,
    'show_in_graphql' => true
));

I was missing the 'show_in_graphql' => true key:value pair.