GCBGutenberg
Control Blocks
v1.3.3
Buy

Moving from ACF Blocks to GCB

How an ACF block maps to block.json, block.fields.json and render.php, and how to move the pages that already use it.

ACF Blocks and Gutenberg Control Blocks (GCB) are built on the same idea: a PHP template plus a list of fields, with no React. That makes moving across mostly a matter of renaming things. There's no importer for ACF blocks in GCB, so you move one block at a time, by hand. This guide shows how a block maps across, and what to do about pages that already use it.

What maps to what

ACF BlocksGCB
Metadatablock.json with an acf key for the mode and templatePlain block.json, nothing GCB-specific in it
FieldsA field group with the location rule "Block is equal to …"block.fields.json in the block's folder
TemplateReads values with get_field()render.php reads $attributes
Block nameWhatever block.json saysgcb/ plus the folder name
Where it livesRegistered with register_block_type()blocks/{name}/ in your theme, found and registered for you

1. Make the folder

Create blocks/testimonial/ in your theme. Copy the block.json across, change the name to gcb/testimonial, and delete the acf key. Leave attributes empty, because GCB makes them from your fields. You don't need a render line either, as GCB finds render.php in the folder.

block.json
{  "apiVersion": 3,  "name": "gcb/testimonial",  "title": "Testimonial",  "category": "widgets",  "icon": "format-quote"}

If you'd rather start clean, Gutenberg Control Blocks → Blocks → + New, or wp gcblite scaffold, writes the folder for you.

2. List the fields

Each field in the ACF field group becomes one entry in block.fields.json. Keep the field names as the attributeKey, and the template changes stay small.

block.fields.json
{  "controls": [    { "id": "c_quote", "type": "textarea", "label": "Quote", "attributeKey": "quote",      "validation": { "required": true } },    { "id": "c_author", "type": "text", "label": "Author", "attributeKey": "author" },    { "id": "c_photo", "type": "image", "label": "Photo", "attributeKey": "photo" }  ]}

Most ACF field types have a direct match:

ACF fieldGCB field type
Text, Text Area, Email, Number, Rangetext, textarea, email, number, range
Wysiwyg Editorrichtext (wysiwyg also works)
True / Falsetoggle
Select, Radio Button, Checkboxselect, radio, checkbox-group
Button Grouptoggle-group for one choice, button-group for several
Link, URL, Page Linkurl
Image, Gallery, File, oEmbedimage, gallery, file, oembed
Color Pickercolor, which offers your theme's palette
Date Picker, Date Time Pickerdate, datetime
Post Object, Relationship, Taxonomy, Userpost-object, taxonomy, user
Google Map, Icon Pickergoogle-map, icon
Group, Tab, AccordionA group panel. It arranges the sidebar and stores nothing.
RepeaterA repeater field, or child blocks on the canvas
Flexible ContentChild blocks, with an <InnerBlocks> area that allows each layout's block

Flexible Content is the one that changes shape. Each layout becomes a small block of its own, and your client adds them on the canvas. The repeater guide helps you choose between a repeater field and child blocks.

3. Change the template

Copy the ACF template into render.php. Replace each get_field('name') with $attributes['name'], and echo get_block_wrapper_attributes() on the outer element. Before:

testimonial.php
<?php $quote = get_field('quote'); $author = get_field('author'); ?><blockquote class="testimonial">  <p><?php echo esc_html($quote); ?></p>  <cite><?php echo esc_html($author); ?></cite></blockquote>

After:

render.php
<?php$quote  = $attributes['quote'] ?? '';$author = $attributes['author'] ?? '';$photo  = $attributes['photo'] ?? [];?><blockquote <?php echo get_block_wrapper_attributes(['class' => 'testimonial']); ?>>  <?php if (!empty($photo['url'])) : ?>    <img src="<?php echo esc_url($photo['url']); ?>" alt="<?php echo esc_attr($photo['alt'] ?? ''); ?>">  <?php endif; ?>  <p data-gcb-field="quote" data-gcb-field-type="text"><?php echo esc_html($quote); ?></p>  <cite data-gcb-field="author" data-gcb-field-type="text"><?php echo esc_html($author); ?></cite></blockquote>

Three things to watch:

  • Value shapes. $attributes holds the stored value of each field. An image is an object (url, alt, width, height, id and its focal point), and a url field is { url, text, opensInNewTab }. Each field page lists its shape.
  • Escaping. Escape every value as you print it.
  • Editing on the page. The data-gcb-field attributes are optional. With them, your client types the quote where it sits.

Your template variables change as well. GCB's render.php gets $attributes, $content and $block, like a core block's PHP render.

4. Move the pages that use it

This is the part to plan. Pages built with ACF keep the ACF block name, and by default ACF keeps the block's values in the block's HTML comment in the post content. Adding a GCB block doesn't change those pages. They still use the ACF block until you move them, and if you turn ACF off first, WordPress can't render them.

You have two ways to move them:

  • By hand. For a few pages, insert the GCB block, copy the words and pictures across, and delete the old block.
  • With a one-off script. For many pages, rename the blocks and rewrite their values with WordPress's own parse_blocks() and serialize_blocks().

Open a page in the Code editor first to see exactly how your ACF version saved the block, then write the script to match:

move-testimonials.php
<?php// Back up the database, then run once: wp eval-file move-testimonials.phpfunction move_testimonials(array $blocks): array {    foreach ($blocks as &$block) {        if ($block['blockName'] === 'acf/testimonial') {            $old = $block['attrs']['data'] ?? [];   // match what the Code editor shows            $block['blockName'] = 'gcb/testimonial';            $block['attrs'] = [                'quote'  => $old['quote'] ?? '',                'author' => $old['author'] ?? '',            ];        }        $block['innerBlocks'] = move_testimonials($block['innerBlocks']);    }    return $blocks;} foreach (get_posts(['post_type' => 'any', 'post_status' => 'any', 'numberposts' => -1]) as $post) {    if (strpos($post->post_content, '<!-- wp:acf/testimonial') === false) continue;    $content = serialize_blocks(move_testimonials(parse_blocks($post->post_content)));    wp_update_post(wp_slash(['ID' => $post->ID, 'post_content' => $content]));}

Keep these in mind when you run it:

  • Rich values need building. Text copies straight across. An image, link, gallery or repeater needs the shape the GCB field stores. For an image, that means looking up the attachment and building the object.
  • Not everything is a post. 'any' leaves out some post types, such as synced patterns and Site Editor templates. Run those separately, and update any ACF block names in your theme's template files by hand.
  • Values in post meta. A block registered with usePostMeta keeps its values in post meta, not in the block. Read them from there.

Keep ACF active until every page is moved. Then check each block in the editor before you switch it off.

GCB's Move content tool (on the Eject page) only moves GCB blocks to an ejected plugin. It doesn't read ACF blocks.

What you get after the move

  • Your client edits text, images and links on the canvas, including repeater rows.
  • A block can have more than one InnerBlocks area.
  • Validation rules stop a page saving until a required field is filled.
  • Eject turns your blocks into plain WordPress blocks if you ever leave.

GCB and ACF Blocks compared sets the two side by side.

Try it

The Quickstart builds a first block. Writing a block covers block.json, block.fields.json and render.php, and the field reference has every field type and its stored value.

Checked against ACF's own docs and release notes on 27 November 2026: ACF Blocks in ACF 6, Create your first ACF block, ACF field types, ACF 6.3 release (post meta storage).

Build anything in the block editor

Every licence includes all features and a year of updates and support.

Buy GCB from $8.25 a month See pricing