Gutenberg block development has long been a challenge for developers unfamiliar with React, Node.js, and JavaScript-heavy workflows. With the introduction of PHP-only blocks, WordPress is lowering the barrier to entry for custom block creation, offering a streamlined path for developers who prefer working exclusively in PHP.
Starting with Gutenberg version 21.8, developers can now register and manage blocks entirely in PHP without requiring JavaScript files or complex build steps. This experimental feature is poised to reshape how developers interact with the block editor, particularly those working on hybrid themes or traditional PHP-based projects. However, practitioners should note that PHP-only blocks remain in the experimental phase and are not yet recommended for production environments.
Why PHP-Only Blocks Matter
Historically, creating Gutenberg blocks required advanced knowledge of server-side JavaScript and React. This steep learning curve discouraged adoption among seasoned WordPress developers rooted in PHP workflows. The PHP-only approach addresses this gap by allowing block registration using nothing but server-side PHP code.
When the auto_register support flag is set to true, the blocks are automatically rendered in both the editor and frontend using PHP. This eliminates the need for Node.js environments and JavaScript tooling, enabling developers to focus on leaner, faster, and easier-to-maintain projects.
For developers managing legacy PHP functionality or shortcodes, PHP-only blocks can act as wrappers, helping bridge the gap between traditional workflows and modern block-based editing. They also open doors for server-side custom integrations that weren’t previously feasible with JavaScript-heavy block registration.
How To Build Your First PHP-Only Gutenberg Block
Building a PHP-only block starts with the register_block_type function, which now supports the auto_register flag. Below is a simple example:

/**
* Render callback (frontend and editor)
*/
function my_php_only_block_render( $attributes ) {
return ' 🚀 PHP-only Block
This block was created with only PHP!
';
}
/**
* Register the block on the 'init' hook.
*/
add_action( 'init', function() {
register_block_type( 'my-plugin/php-only-test-block', array(
'title' => 'My PHP-only Block',
'icon' => 'welcome-learn-more',
'category' => 'text',
'render_callback' => 'my_php_only_block_render',
'supports' => array(
'auto_register' => true,
),
) );
});
To implement this block, copy the code into the main file of a custom plugin and activate it. The block will then appear in the editor’s block inserter under the name “My PHP-Only Block.”
Key attributes such as title, icon, category, and render_callback are specified when registering the block. The auto_register flag ensures proper metadata handling and automatic rendering in the editor.
What To Do
- Developers: Experiment with PHP-only blocks in local or staging environments, leveraging Gutenberg 22.3+ for compatibility.
- Agencies: Train PHP-focused teams on this simplified block registration model to accelerate custom block creation without JavaScript expertise.
- Hosting Providers: Ensure staging environments support Gutenberg 22.3+ for compatibility testing of PHP-only blocks.