The WPGraphQL for Advanced Custom Fields plugin is now available for free on GitHub after a short time as a commercial product. Jason Bahl, creator and maintainer of the WPGraphQL project, released the extension in April 2019 with a pricing tier ranging from $49/annually (for one site’s support) to lifetime subscription options.
Bahl created the plugin with the hopes of generating enough revenue to one day fund his efforts working on WPGraphQL full-time. Now that he has joined the Gatsby team to work full time on WPGraphQL, he has the time and resources to make the ACF extension available for free.
The plugin allows developers to interact with their ACF data using GraphQL queries. It works with both the free and pro versions of ACF and WPGraphQL v0.3.2 or newer.
“When I first started working on the core WPGraphQL plugin, I thought it would be awesome to have meta fields automatically exposed to the WPGraphQL Schema,” Bahl said.
“Since WordPress core doesn’t have a fields API, developers turn to plugins such as Advanced Custom Fields, Metabox.io, CMB2, Carbon Fields, Field Manager, or one of the many other metabox solutions for WordPress.”
ACF is by far the most popular among these solutions with more than a million active installs. (Metabox.io has roughly half the user base with 400,000+ installs and CMB2 is the next most popular at an estimated 200,000 installs). Bahl started working towards supporting ACF a few years ago but didn’t have a production use case for it and left it untouched until demand for the plugin increased.
“In the latter half of 2018 and early 2019 I got many requests via Slack, Twitter, and Github for a quality ACF extension, and I also noticed the top search terms on the WPGraphQL website were ‘ACF’ and ‘Advanced Custom Fields,’ he said.
“I initially wanted to release the plugin as a free plugin, but there’s only so much I can do for free. Maintaining WPGraphQL on the side of my full-time job was already time consuming and I thought if I was making income I could support it better.”
Since the plugin’s initial release on April 19, Bahl reports there have been 85 licenses purchased, which enabled him to devote more time to the project. Now that he is no longer attempting to self-sustain his projects, he and the Gatsby team decided the best course of action would be to make it free so that more of the community can benefit from the project. He anticipates being able to provide the same level of support since the plugin’s launch with more of his time allocated to focusing on the WPGraphQL ecosystem.
Performance is the most common reason that necessitates developers using ACF to implement WPGraphQL on their sites. It offers staggering performance gains over using the WP REST API to query ACF data, as shown in the example below:
Good call. . .I need to market the performance side better. . .here's an example of a REST API call using ACF to REST API and using WPGraphQL for ACF to select specific fields.
*REST:* 24.8 KB, 1.22s
*GraphQL*: 1010 b, 377ms (not even 1kb payload!!!) pic.twitter.com/0qS52bvlEY
— GraphQL for WordPress (@wpgraphql) April 19, 2019
“When developers try to build “headless” applications with WordPress, they often run into pain points with the WP REST API, and they turn to WPGraphQL to ease those pains,” Bahl said.
“Many developers were registering ACF fields to their WPGraphQL Schema by hand, and that can be a tedious process if you have hundreds of fields. A plugin like WPGraphQL for Advanced Custom Fields saves developers a lot of development time, and allows them to take advantage of the features of GraphQL that make headless WordPress development a pleasant experience.”
WPGraphQL for Advanced Custom Fields can be found on GitHub and support and feature requests are handled through Github issues. The plugin is also available on packagist.org for those who want to include it in projects using Composer.
Developers with general questions can join the WPGraphQL Slack workspace or the project’s online community on Spectrum. Bahl is active in both communities, helping developers find answers to their questions about using WPGraphQL to build headless applications.
This is good news and the plugin’s author does highlight an issue with the Rest API in WordPress core. It’s not used as much as it should be and there are performance issues that need to be rectified.