Advanced Custom Fields 5.8.0 Introduces ACF Blocks: A PHP Framework for Creating Gutenberg Blocks

After six months in development, Advanced Custom Fields 5.8.0 was released yesterday with a new PHP-based framework for developing custom Gutenberg block types. ACF Blocks was announced in October 2018, to the great relief of many developers who didn’t know how they were going to keep pace with learning the JavaScript required to use WordPress’ Block API.

ACF’s creator, Elliot Condon, was one of the more vocal critics of Gutenberg leading up to its inclusion in WordPress 5.0. Developers were concerned about whether or not their custom metaboxes generated by ACF would still be compatible. The ACF team worked to ensure the plugin was integrated into the Gutenberg UI as much as possible and surprised users by announcing an acf_register_block() function that would allow developers to use PHP to create custom blocks.

The new ACF Blocks add-on is built on top of Advanced Custom Fields Pro and does not require any JavaScript knowledge. It integrates with custom fields so developers can create custom solutions. ACF blocks are rendered using a PHP template file or a callback function that allows full control of the output HTML and live previews while editing the blocks. They also maintain native compatibility with WordPress core, meaning that all Gutenberg features like “alignment” and “re-usable blocks” work as expected.

Early feedback indicates that ACF Blocks has made custom Gutenberg development more approachable for developers who are not as well-versed in React, significantly speeding up the creation of custom blocks.

This is one example of how the WordPress product ecosystem continues to evolve to support developers in the transition to a more JavaScript-powered WordPress.

ACF Blocks also launched with a suite of nine ready-to-use bocks available as a plugin from the new acfblocks.com website. These include commonly-requested functionality for client sites, such as testimonial, team, multi-button, star-rating, pricing list, and click-to-tweet, with more on the way.

12

12 responses to “Advanced Custom Fields 5.8.0 Introduces ACF Blocks: A PHP Framework for Creating Gutenberg Blocks”

  1. The “ACF Blocks” on org and with domain acfblocks.com is an independent product from the original “Advanced Custom Fields”, but it requires it.

    I know that the naming of “ACF Blocks” for a plugin here is not ideal. Just would mention that these are 2 different devs/ products.

  2. Congrats to the ACF team for bringing such value and utility to the plugin.

    This shows that the WP Core team could implement a PHP Block API if they wanted to. Doing so would make block creation accessible to more developers. I hope they get inspired.

  3. Glad to see the ACF team making block creation easier this will make the transition to Gutenberg easier.

    Just a suggestion, I think the article should make it clear that ACFBlocks.com while requiring ACF was not created by the Elliot and ACF team.

  4. If creating blocks with Custom Fiels is going to be that easy like how it is shown in the featured image, then this is going to improve a lot the enviroment for developing blocks.

    But on the other hand, creating a block in javascript that renders on server is not that hard…

    Maybe the only problem I have come across, badly, with Javascript and React with gutenberg is how to handle deprecations when you update your block…

    Easiest way I have found out is to simply return a “new block” of the same block you are updating.

    Of course, lerning javascript was much more easy than I expected. But I am only playing with the surface still.

    But one thing is sure: When you develop blocks the PHP way, you save yourself a bunch of issues.

  5. > This is one example of how the WordPress product ecosystem continues to evolve to support developers in the transition to a more JavaScript-powered WordPress.

    Well, looks more like that one developer of ACF Pro makes it possible that all the other developers do NOT need to evolve with any transition to JavaScript.

    Thanks Elliot.

  6. “ACF blocks are rendered using a PHP template file or a callback function that allows full control of the output HTML and live previews while editing the blocks. ”

    For those who don’t already know, you can use the WP Core (PHP) function register_block_type() and the ‘render_callback’ arg to override the frontend presentation of any block. However, you’ll be subject to how the block stores its attributes.

    https://developer.wordpress.org/reference/functions/register_block_type/

  7. Has anyone seen any info / docs on what is going on under the hood here? Aside from not having to learn React, what are the advantages and/or disadvantages?

    Yes, the no need to learn React can be a benefit. But does that come at some other cost?

  8. Has anyone seen any info / docs on what is going on under the hood here? Aside from not having to learn React, what are the advantages and/or disadvantages?

    Yes, the no need to learn React can be a benefit. But does that come at some other cost?

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.