Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying ACF/Option fields via GraphQL - Set language? #40

Open
chrschick opened this issue Feb 11, 2021 · 2 comments
Open

Querying ACF/Option fields via GraphQL - Set language? #40

chrschick opened this issue Feb 11, 2021 · 2 comments

Comments

@chrschick
Copy link

Hi,

It's more like a question but an issue.

We're using Polylang in combination with WPGraphQL Plugin and also ACF.
When we're trying to query specific ACF Options field values via custom endpoints, we don't receive anything but NULL.

Is there any chance to set the language and get the correct data from option fields while resolving our request?
I tried to set the language with some class functions delivered within the plugin.

PLL()->curlang = PLL()->model->get_language($args['language']);
echo pll_current_language();  // Returns the language set by the line above

Sadly this line doesn't work, it seems that the language isn't really set inside the context.

@esamattis
Copy link
Member

What do you mean with "custom endpoint"?

@simplenotezy
Copy link

I believe this is related to my issue;

I am trying to register a GraphQL field (https://www.wpgraphql.com/2020/03/11/registering-graphql-fields-with-arguments/), and inside the resolve callback, I need to do a WP query, and for that I’d like to query posts in specific language. How can I get the current language? Unfortunately pll_current_language() returns false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants