WPGraphQL is a free WordPress plugin that adds a GraphQL API endpoint, solving REST API limitations like over-fetching and multiple requests. The guide covers installation via dashboard or Composer, using the built-in GraphiQL IDE, registering Custom Post Types (CPTs) in the schema via PHP, filters, or Custom Post Type UI, and exposing ACF field groups through the WPGraphQL for ACF plugin. It also explains how ACF field types (Repeater, Flexible Content, Gallery, Options Pages) map to GraphQL types, how to paginate with the Relay connection model, and production concerns including caching with WPGraphQL Smart Cache (persisted queries and tag-based invalidation) and authentication strategies (Application Passwords vs JWT tokens) for headless frontends.

13m read timeFrom advancedcustomfields.com
Post cover image
Table of contents
How WPGraphQL works and why developers use it instead of the WordPress REST APIInstalling WPGraphQL and testing queries in GraphiQLRegistering custom post types for the GraphQL schemaExposing field groups with WPGraphQL for ACFCaching and deploying WPGraphQL in productionGet started with WPGraphQL and ACF

Sort: