Beta Software Notice
Don’t hesitate to start using the plugin, but just be sure to follow along with releases and keep up to date with conversations in Slack join here
For the most stable and performant experience, it’s recommended that you use the most recent version of the plugin. You can see the latest releases here.
Of course, as new features are in development, feel free to check out the latest develop branch or check out any other feature or release.
WPGraphQL is available on Github: https://github.com/wp-graphql/wp-graphql
You can download the plugin or clone the plugin from Github.
Add the downloaded/cloned plugin to your WordPress plugin directory. On a typical WordPress install, this is located at /wp-content/plugins.
Once the plugin is in the WordPress plugins directory, it can be activated by clicking “Activate” on the plugin screen, or via WP CLI
wp plugin activate wp-graphql
The most common use of WPGraphQL is as an API endpoint that can be accessed via HTTP requests (although it can be used without remote HTTP requests as well)
In order for the /graphql endpoint to work, you must have pretty permalinks enabled and any permalink structure other than the default WordPress permalink structure.
Once the plugin is active, your site should have a
yoursite.com/graphql endpoint and you the expected response is a JSON payload like so:
Unlikely, but If things aren’t working at this point, you may need to flush permalinks
Flush Permalinks (not typically necessary)
Activating the plugin should cause the permalinks to flush. Occasionally, this doesn’t work. If you have a permalink structure other than the default WordPress structure, and the plugin is active but nothing shows at your site’s /graphql endpoint, try to manually flush your permalinks by:
- From your WordPress dashboard, visit the Settings > Permalinks page. Just visiting the page should flush the permalinks
- Using WP CLI run wp rewrite flush
WPGraphQL can be used from the context of WordPress PHP and doesn’t require HTTP requests to be used. You can completely remove the
/graphql endpoint that the plugin provides so that the API is not available publicly in any way but still use GraphQL in your plugin and theme code by using:
do_graphql_request( $request, $operation_name, $variables );