1. Home
  2. News
  3. Gatsby Source WordPress Plugin v4 Released

Gatsby Source WordPress Plugin v4 Released

Share

Gatsby Source WordPress plugin is out of beta and has been officially released on in the stable version v4.0.1.

Gatsby’s team released Gatsby Source WordPress version 4 on . After the release of version 4.0.1, gatsby-source-wordpress-experimental has been deprecated in favor of the new stable version of gatsby-source-wordpress@4.0.1.

gatsby-source-wordpress v4 logo
gatsby-source-wordpress official image, from gatsbyjs.com

Should you upgrade to the newer version? Absolutely yes. gatsby-source-wordpress-experimental is, as the name implies, experimental. Therefore, we absolutely recommend upgrading as it marks the transition from a beta/alpha version to a stable version.

What’s new on version 4

The new release of the plugin significantly reduces incremental build times. This has been possible by merging WPGraphQL schema with the Gatsby schema, allowing to efficiently cache WP data. Consequently, we now have faster incremental builds and theme previews.

WPGraphQL official WordPress plugin page

This is a major change and improvement over v3 which used to generate the Gatsby schema using WP Rest APIs. According to Gatsby’s team, the data shape and fields for each type may vary. For example, featured_image in v3 becomes featuredImage in v4.

Even if many of the core WordPress data fields remain the same, you may need to install WPGraphQL extensions if you are missing some custom data or fields that have been added by extensions. For example, if you want to get Advanced Custom Fields to work together with WPGraphQL you will need to install WPGraphQL for Advanced Custom Fields.

Migrating from gatsby-source-wordpress-experimental

The plugins are exactly identical, except for minor fixes. Hence, migration from gatsby-source-wordpress-experimental is extremely simple.

These are the few and simple steps to follow:

  1. Uninstall gatsby-source-wordpress-experimental
npm remove --save gatsby-source-wordpress-experimental
  1. Install gatbsy-source-wordpress
npm install --save-dev gatsby-source-wordpress
  1. Update gatsby-config.js file removing “experimental” from the plugin
module.exports = {
  siteMetadata: {
    title: `Polynique | Coding & Development Blog`,
    description: `Polynique is a news blog entirely dedicated to programming, development, tools and businesses. News, tutorials, guides, coding, how to and much more.`,
    author: `@polynique`,
    siteUrl: `https://www.polynique.com`,
  },
  plugins: [
    {
      resolve: `gatsby-source-wordpress`,
      options: {
        /*
         * The full URL of the WordPress site's GraphQL API.
         * Example : 'https://www.example-site.com/graphql'
         */
        
        /**
         * ...Other options
         */
      },
    },
  ]
}

Done! Easy, right?

Conclusion

In conclusion, the upgrade is very simple to perform and shouldn’t cause any problems. We recommend the update because, in addition to the major changes we have already talked about, the update brings many other minor bug fixes, such as Gatsby crashing when uploading an image to WordPress.

More resources:

If you like our post, please share it: