Gatsby's source plugin for WordPress has moved to a beta release. The plugin, gatsby-source-wordpress@v4, is published on GitHub rather than in the WordPress Plugin Directory, as are the two WordPress-side plugins it depends on: WPGraphQL and WPGatsby.

How the pieces fit

WPGraphQL turns WordPress into a GraphQL API server, exposing an endpoint for WordPress data. WPGatsby reshapes that data to conform to the Gatsby schema. In the new plugin version the GraphQL schema and the Gatsby schema are merged, and Gatsby Cloud joins the stack.

The practical payoff comes from caching: the plugin can write data to Gatsby's node cache, which is what enables the features below in Gatsby Cloud. The arrangement is arguably the most direct route to pairing React with WordPress.

  • Content can be previewed as you write it with Gatsby Preview.
  • Incremental Builds, available only on Gatsby Cloud, push updates or new content almost instantly.
  • Links and images inside content HTML work with gatsby-image and gatsby-link, resolving a common complaint about the original WordPress source plugin.
  • The number of nodes fetched during development can be limited, so site changes and new pages and features can be iterated on quickly.
  • Only images referenced in published content are processed, so a large media library does not slow build times.
  • Any WPGraphQL extension makes its data available to the Gatsby project automatically, letting a site draw on WordPress SEO, content modeling, translation and ecommerce plugins through a single source plugin.

What incremental builds change

Live preview is a welcome addition, but incremental builds alter the deployment model itself: there is no longer a full site rebuild each time content is written. Only the updated files are pushed, which means faster builds and fewer bugs. CSS-Tricks star logo

Getting started

For developers assembling a React front end with WordPress as the CMS, Ganesh Dahal's two-part series on CSS-Tricks provides a step-by-step walkthrough of a decoupled WordPress and Gatsby site.

Direct Link →