Before WordPress 7.0, every block needed JavaScript to appear in the editor, even when PHP drew all of its markup. WordPress 7.0 changed that. A block can now be registered in PHP alone: you give it attributes and a render callback, and the editor builds the rest. This guide covers how it works, what it does well, where it stops, and what Gutenberg Control Blocks (GCB) adds on top.
Checked against make.wordpress.org, developer.wordpress.org and the Gutenberg repository on 27 November 2026. If something here is out of date, tell us and we'll fix it.
What it is
The feature is called PHP-only block registration. It started as an experiment in Gutenberg 21.8 (#71794), was made stable in Gutenberg 22.6 (#75543), and shipped in WordPress 7.0, where the 7.0 Field Guide lists it.
The dev note is clear about its scope. It's "meant for blocks that only need server-side rendering and aren't meant to be highly interactive", and it "isn't meant to replace the existing client-side paradigm, nor is it meant to ever be as featureful".
How you register one
You call register_block_type() with the autoRegister support turned on and a render_callback. Both are needed: the dev note says "a render_callback function must also be provided". Each attribute can have a type, a default, a label and an enum.
add_action( 'init', function () { register_block_type( 'my-theme/notice', array( 'attributes' => array( 'title' => array( 'type' => 'string', 'default' => '', 'label' => __( 'Title', 'my-theme' ) ), 'count' => array( 'type' => 'integer', 'default' => 3 ), 'enabled' => array( 'type' => 'boolean', 'default' => true ), 'size' => array( 'type' => 'string', 'enum' => array( 'small', 'medium', 'large' ), 'default' => 'medium' ), ), 'render_callback' => function ( $attributes ) { return sprintf( '<div %s>%s</div>', get_block_wrapper_attributes(), esc_html( $attributes['title'] ) ); }, 'supports' => array( 'autoRegister' => true ), ) );} );That's the whole block. There's no edit.js, no package.json and no build. The registration handbook page and the block supports reference show the same pattern.
What the editor gives you
- A server-rendered preview. The handbook says these blocks "will automatically be registered in the editor and use
ServerSideRender". The preview is your render callback's output, and it can't be clicked into. - Generated sidebar settings. The editor builds a Settings panel from the attributes. In core, only
string,number,integerandbooleanattributes get a control (auto-register.php). A string becomes a text field, a number or integer a number field, a boolean an on/off setting, and a string with anenuma select (#74102). The select shows the raw enum values as its labels. - Block supports. Colour, spacing and the other supports work, and get WordPress's usual panels (#72039).
Some attributes never get a control: those with a source, those with the local role, and those added by block supports. The dev note says "controls will not be generated for attributes with the local role or for attributes whose types are not supported."
Where it stops
- No editing on the canvas. A closed Gutenberg pull request puts it plainly: "As of WP 7.0, PHP-only blocks appear in the editor as a preview you can't edit on the canvas; you change their settings in the sidebar instead." (#79831). Work to add this for 7.1 was closed without being merged.
- No image, link or rich text fields. Richer field types were planned for 7.1 in the tracking issue, which closed without them. The Gutenberg plugin (24.1 and later) can show a list of choices for an
arrayattribute you mark yourself (Gutenberg 24.1), but that isn't in WordPress core yet. - No InnerBlocks. Nested blocks aren't supported. The issue for them is still open.
- No validation. There's nothing to stop a page saving with an empty required setting. Showing validation errors is an open issue.
None of this is a fault. It's the scope the feature set itself. For a block with a few plain settings, like a notice, a latest-posts list or a contact line, it's the simplest way to make one, and it's free.
Where GCB adds to it
GCB is for the blocks a client edits every week: heroes, cards, features, galleries and testimonials. It also keeps JavaScript out of your theme. A block is a folder with block.json, a list of fields in block.fields.json and a render.php template. GCB turns the fields into ordinary block attributes and registers the block with register_block_type(), so the result is a normal WordPress block.
| Core PHP-only blocks | GCB | |
|---|---|---|
| Build step | None | None |
| Where the block is described | PHP array in register_block_type() | block.json, block.fields.json and render.php in a folder |
| Field types | Text, number, on/off and select | 42, including image, gallery, link, rich text, repeater, post and term pickers |
| Editing on the canvas | No; the preview is sidebar-only | Text, images and links are edited where they sit, repeater rows included |
| InnerBlocks | Not supported | As many areas per block as the design needs, each with its own allowed blocks |
| Repeating items | Not available | A repeater field, or child blocks with min and max |
| Validation | None | Required, length, pattern and number rules; the page won't save until they pass |
| Theme presets | Through block supports | Colour, font size and spacing fields offer your theme.json presets |
| WordPress version | 7.0 or later | 6.8 or later |
| Price | Free, in core | $99, $249 or $499 a year (1, 10 or unlimited sites) |
Two more things matter on a busy page. GCB loads every block's editor preview in one batched request, rather than one request per block. And if you stop using GCB, the Eject page turns your blocks into a standalone plugin of plain WordPress blocks, with their fields and validation rules bundled in.
Which to use
- A block with a handful of plain settings, edited now and then: use core's PHP-only registration. It's built in and needs nothing else.
- A block your client edits often, with pictures, links, lists or content areas: that's where GCB helps. The template stays plain PHP, and the client edits the real design on the page.
- A block that is really an app, like a calculator or a booking form: write it in React with
@wordpress/create-block.
You can mix all three on one site. They're all WordPress blocks. The first-block guide shows GCB's three files, and custom block plugins compared puts GCB beside the other options.
Checked against the PHP-only block registration dev note, the WordPress 7.0 Field Guide, Registration of a block, Block supports: autoRegister, core's auto-register.php and Gutenberg #71794, #72039, #74102, #75543, #79831, #75794, #79330 and #85936 on 27 November 2026.