Build a headless WordPress site using Next.js or Astro for the frontend while WordPress manages content in the background.
Query specific WordPress posts, pages, and custom fields in a single API request without over-fetching data.
Add network-level caching to WordPress content queries using the Smart Cache plugin extension.
Register custom fields and connections to the GraphQL schema using standard PHP functions.
Requires an existing WordPress installation, install the plugin from WordPress.org and the GraphQL API is immediately available.
WPGraphQL is a free WordPress plugin that adds a GraphQL API to any WordPress site. GraphQL is a way of querying data where you describe exactly which fields you want and receive only those fields in a single response, rather than getting a fixed set of data from multiple separate requests. Installing this plugin exposes all of your WordPress content through that kind of API. This opens the door to building what is commonly called a headless WordPress setup: WordPress runs in the background managing content (posts, pages, users, menus, taxonomies, custom post types), while the front-end of the website is built with a separate framework of your choice. Next.js, Svelte, and Astro are mentioned as examples. The WordPress admin stays familiar for editors, but the public-facing site is built independently and fetches its data from WPGraphQL. The schema covers the full range of core WordPress data. Extension plugins expand it further: WPGraphQL for ACF adds support for Advanced Custom Fields, and WPGraphQL Smart Cache adds network-level caching and automatic cache invalidation so repeated queries do not hit the database each time. Developers can also register their own fields and connections to the schema using built-in WordPress-style PHP functions. The repository is organized as a monorepo containing the core plugin, the IDE extension, the Smart Cache plugin, and the ACF integration, along with the source for the wpgraphql.com documentation site. For anyone just installing the plugin, none of that structure matters: you install it from WordPress.org, activate it, and the API is immediately available. A built-in GraphiQL browser interface lets you explore and test queries directly from the WordPress admin panel. Documentation, a Discord community, and a live demo environment are all linked from the project website.
← wp-graphql on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.