GCBGutenberg
Control Blocks
Buy

Building blocks

Eject to plain WordPress

Eject turns GCB blocks into one standalone plugin of native Gutenberg blocks that works with GCB switched off, or on a WordPress site that never had GCB. Each block keeps its render.php, its styles, its sidebar fields and their validation rules; everything that belonged to GCB is renamed to the new plugin's own name or left out, and a set of checks runs before you get the zip. Then Move content moves the pages already built with the GCB blocks onto the new ones.

Use it when a block has to live without GCB: handing a site over, moving blocks to another site, or simply knowing you can leave.

From the admin: Gutenberg Control Blocks → Eject

The Eject page (administrators only) lists every GCB block the site has: the active theme's and its parent theme's blocks/ folders, and any folders added with gcblite_block_dirs or gcblite_eject_search_dirs.

  1. Tick the blocks you want (or Select all). A block's child blocks (the ones its <Repeater> or <InnerBlocks> lets in) come with it.
  2. Read the preview. It is a dry run of the real eject, updated as you tick:
    • Carries over: each block with its children, the render helpers it calls, the kit parts it uses, and how many pictures go with it.
    • Needs manual work: anything that could not be carried, and every check that failed, with the reason. "Nothing: every block carries over and every check passed." means it is ready.
    • Checks: each check, ok, failed or skipped (see below).
  3. Name it. Plugin name (default "Site Blocks") gives the plugin its folder, text domain and block namespace: "Thread Co Blocks" becomes thread-co-blocks, and gcb/hero becomes thread-co-blocks/hero. Version defaults to 1.0.0.
  4. Download. You get <plugin-name>.zip, ready for Plugins → Add New → Upload. To add blocks later, eject again with every block ticked, raise the version, and upload it with "Replace current with uploaded".

Nothing is built on your server: the blocks' editor script comes prebuilt with GCB and the download only copies files (about half a second for three blocks). The page needs PHP's Zip extension; without it, it says so and offers no download.

From the command line

Shell
wp gcblite eject-blocks <block>… [--name=<name>] [--plugin-version=<version>] [--zip=<path>] [--out=<dir>] [--format=json]
Shell
wp gcblite eject-blocks hero pricing faq --name="Thread Co Blocks" --plugin-version=1.0.1 --zip=./thread-co-blocks.zip
OptionWhat it does
<block>…One or more block slugs (hero for gcb/hero), or block folders. Each comes with its child blocks.
--nameThe plugin's name; its slug, text domain and block namespace are made from it. Default Site Blocks.
--plugin-versionThe plugin's version. Default 1.0.0.
--zipWhere to write the zip. Default: a temp folder.
--outWhere to write the unzipped plugin folder. Default: a temp folder.
--sources-out, --sources-zipWhere to keep a copy of the block sources used (and zip it). Default: beside the plugin folder.
--sourcesFolders of sources kept by an earlier eject, comma-separated: every block in them goes in too, so the next plugin holds the earlier blocks and the new ones.
--clean-plugins, --clean-wpA clean WordPress to run the render check on: its plugins folder, and the WP-CLI command that runs on it.
--buildruntime (default): GCB's prebuilt editor script is copied in; no Node.js needed. node: the editor is built here from the plugin's own source with Node.js and npm (the first build installs @wordpress/scripts and @wordpress-gcb/fields into the system temp folder, or the folder named by GCBPRO_EJECT_NODE_CACHE, which takes a few minutes).
--formattext (default) prints each check, then the plugin, blocks, helpers, kit parts, how the editor was made and the zip's path. json prints one object.

It exits with an error, and writes no zip, when a check fails. wp gcblite eject-block is the same command. The names from before (wp gcbpro eject-blocks, wp gcbpro eject-block) still run, with a warning that they are deprecated.

Ejecting three blocks takes about 0.6 s with the prebuilt editor (5.2 s with --build=node and its tools already installed; minutes the first time).

There is also wp gcblite eject <slug> [--dry-run] [--to=<dir>], the older eject of one block into a native block folder beside the original, with a report of what carries over.

Move existing content to the ejected blocks

The ejected blocks are named after the plugin (solace-blocks/hero, not gcb/hero), so pages already built with the GCB blocks keep using the GCB blocks until their content is moved. Moving renames the blocks in the saved content and nothing else: every attribute, word and setting stays byte for byte (the ejected block.json keeps the same attribute names), and other blocks are not touched. It covers every post type: posts, pages, custom types, synced patterns (wp_block), and templates and template parts edited in the Site Editor (wp_template, wp_template_part). A block's areas (gcblite/area) move with it, to the plugin's own area block (<plugin>/area); areas of a block that is not moving stay as they are.

Every move can be undone. Before it changes a post, it saves the post's content as a revision (for types that keep revisions) and keeps a copy in a meta row (_block_eject_moved). Undo puts the kept copy back when the post has not been edited since; if it has, it renames the blocks back and keeps the edits. Each move keeps its own copy, so undo steps back one move at a time.

From the ejected plugin, with or without GCB: Tools → Move content to &lt;plugin name&gt; (administrators). It lists each item that would move, with how many of each block, then Move existing content to these blocks (after a confirm). When there is something to undo, Undo the last move is under it. While content still uses the old blocks, the Plugins screen says how many items and links to it. The plugin knows the old names from its migrate.json.

From the command line, with GCB active:

Shell
wp gcblite eject-migrate --to=<namespace> [--from=gcb] [--blocks=<slugs>] [--plugin-dir=<dir>] [--post_type=<types>] [--dry-run] [--undo] [--format=json]
Shell
wp gcblite eject-migrate --to=solace-blocks --dry-run   # each item and its blocks; nothing changes
wp gcblite eject-migrate --to=solace-blocks             # move them
wp gcblite eject-migrate --to=solace-blocks --undo      # put them back
OptionWhat it does
--toThe ejected plugin's namespace (its slug).
--fromThe namespace the blocks had. Default gcb.
--blocksOnly these blocks (hero,lineup). Default: the blocks in the plugin's migrate.json (--plugin-dir, else wp-content/plugins/<to>/), else every block registered under <to>/.
--post_typeOnly these post types, comma-separated. Default: all of them, revisions aside.
--dry-runPrints each item, its type and how many of each block would move, then the totals; changes nothing.
--undoUndoes the last move on each item (--dry-run says which would be restored and which renamed back).

The CLI and the plugin's screen keep the same copies, so either can undo the other's move. Content that is not in the database is not moved: a theme's own template files (.html), patterns registered in PHP, and anything outside post content (a widget, an option) keep the GCB names.

What ships with ejected blocks

  • One editor script, prebuilt. The sidebar fields and the canvas come from one generic editor script, build/index.js (about 580 KB), the same for every ejected plugin and built once with GCB; it reads each block's fields.json (its sidebar) and editor.json (its preview and its children), which the plugin's PHP hands to the editor. It is bundled inside the plugin, with its source in src/ and a package.json (npm install && npm run build rebuilds it), licensed GPL-2.0-or-later like the rest of the plugin.
  • Editor only. Each block names that script as its editorScript, so it loads in the block editor and never on the front end.
  • What the editor carries from GCB.
    • Validation. Each field's validation rules (required, length, number range, pattern, a repeater field's rows) are checked as the person edits: the field shows its message, its panel opens, the block shows "Hero: Heading needs fixing.", the editor shows the same with Find the block, and saving is locked until it is fixed.
    • Repeaters. A <Repeater>'s items are drawn in their place in the block's preview, with its Add button (addButtonLabel; addButton="none" hides it). The button goes once max is reached; below min or above max the block says so and saving is locked; a new block starts with its template, or max(defaultChildren, min) items of its first allowed block.
    • Several areas. A block with numbered <InnerBlocks data-gcb-slot> markers gets one area per marker, each drawn where its marker is, each letting in its own allowedBlocks (and template, templateLock). A block inserted new gets its areas; one saved before areas is arranged into them as GCB does.
  • No licence key, no calls to us. The ejected plugin needs no key and contacts no server of ours. The offline check below verifies that the plugin's code calls no outside address before the zip is offered.
  • What visitors get. Each block's render.php output and its CSS, plus the script of any kit part the block uses (a carousel, a reveal) as its view script. A block with areas prints each area in its place, from the plugin's area blocks or, before the content is moved, from GCB's.

The checks

CheckPasses when
phpEvery PHP file passes php -l.
jsEvery script passes node --check (skipped when Node.js is not installed).
oursNo file still names GCB (gcb, data-gcb, a block.fields.json). The public @wordpress-gcb/fields package the editor is built from is allowed, and so is migrate.json, which lists the names the blocks had for Move content.
offlineThe plugin's code calls no address elsewhere. Addresses in a field's default content, and in the bundled editor and libraries, are listed, not failed.
scopeEvery stylesheet selector starts with one of the plugin's own block classes, so it styles nothing outside its blocks.
renderOn a clean WordPress with only this plugin active, every block renders with empty attributes and no warning.

"render skipped" means no clean WordPress was set up to try the plugin on, so that check did not run; a skipped check does not stop the download. From the Eject page it is always skipped unless the site defines GCBPRO_EJECT_CLEAN_WP (['plugins' => …, 'wp' => …]); from the CLI, pass --clean-plugins and --clean-wp. When it does run, the blocks are also compared under three default themes and the zip is refused if they look different.

Limits

  • Move content first, then switch GCB off. Until content is moved, pages use the GCB blocks, and without GCB they show as unsupported blocks. Move content works from the ejected plugin with GCB off too.
  • What Move content does not reach: a theme's template files on disk, patterns registered in PHP, and block markup kept outside post content. Those keep the GCB names.
  • editLayout. GCB's editor-only editLayout attribute (how the Studio arranges a list's items while editing) is not in the ejected block.json; a saved value is ignored. Every field attribute carries with the same name.
  • A <Repeater> beside numbered areas. A block whose template has a <Repeater> and numbered <InnerBlocks data-gcb-slot> markers does not eject cleanly: the repeater's place prints every child block, and the editor treats the block as one list. Move the repeater into a child block before ejecting.
  • What the ejected editor does not have from GCB's: editing a field on the canvas (inline text, click a field to open its control — the ejected canvas is a preview, edited in the sidebar), the Studio's list layouts (carousel, tabs, strip) for a repeater's items, a pin map placing a repeater's items, the server's save guard (the ejected editor locks the Save button instead of refusing the save on the server), and post fields (gcblite_register_post_fields).
  • Requirements. The ejected plugin needs WordPress 6.6 or later and PHP 7.4 or later.

Built from Gutenberg Control Blocks (GCB) 1.2.0. Source: includes/Eject/, includes/CLI/EjectBlockCommand.php, includes/CLI/EjectCommand.php.

Copyright © 2026 Runchain. WordPress is a trademark of the WordPress Foundation.