wp-graphql-polylang
wp-graphql-polylang copied to clipboard
Does not work when called from PHP using `do_graphql_request()`
See https://github.com/wp-graphql/wp-graphql/issues/1021#issuecomment-555171653
Actually wp-graphql-polylang cannot work at all when called from PHP. That's because Polylang initializes itself into a specific mode which maybe be "admin", "frontend" or "rest" and now via wp-graphql-polylang "graphl" too. Once the intialization has been done it cannot changed anymore (at least to my knowledge).
So in wp-graphql-polylang I must tell it to go to the graphql mode as soon as possible. If it is too late Polylang will initialize into the frontend mode. This does happen before the init. The frontend mode would filter everything by the default language which is no good for a graphql api because you'll want to specify the language using the where-args so you can query posts in multiple languages if you want.