Contents
In brief
Seven and a half years after blocks landed in Core, WordPress 7.0 lets you ship a custom block with PHP only—no React, npm, or build pipeline. The switch is supports.autoRegister: Core generates client registration and the editor preview. CSS-Tricks walks through Hello World, attributes, and why this path does not replace full JavaScript block development.
What happened
A traditional block is registered twice: once in PHP, once in JavaScript. The new mode keeps a single register_block_type call with a render_callback and 'autoRegister' => true. The editor shows server HTML; when settings change, the preview is re-fetched over REST.
Attributes are declared in PHP (string, number, boolean) and map to basic controls in the Settings sidebar—no custom React UI required.
The architecture is simple, with hard limits: the block preview is not a first-class citizen of the editor SPA. Markup is swapped asynchronously, so in-preview interactivity and reliable DOM hooks are effectively off the table.
Why it matters
Many teams stay on classic themes because of legacy PHP: shortcodes, widgets, custom headers. Moving to block themes meant learning React and wiring a toolchain. PHP-only registration removes both barriers for migration: wrap working server code in a block in hours instead of rewriting everything in JS.
For new interactive blocks the path is weak: no in-place editing in the preview, no image upload or multiline rich text in the sidebar, and no fresh client-store data (a PHP block showing the post title keeps the DB value until you save and reload). Post context via Loop globals is also unreliable in the REST preview—an architectural limit as of 7.0.
The author’s formula: valuable as a bridge into block themes, not as a substitute for JavaScript blocks built from scratch.
In practice
- Use PHP-only for widgets, shortcodes, headers/footers, and anything that already works on the front end without editor interactivity.
- Do not demand a perfect preview: front-end correctness wins; a placeholder (like Post Content) is fine.
- Styles via
style/editor_styleandget_block_wrapper_attributes(); scripts only asview_scripton the front end. - Detect editor vs front render with
wp_is_rest_endpoint()plus ablock-rendererroute check—is_admin()will not help. - Work around missing post ID carefully (
localattribute from$_GET['post']at registration)—new drafts get an ID only after save and a full reload. - Only three attribute types today; dropdowns lack label→value pairs—avoid storing only a renameable category slug.
Takeaway
WordPress 7.0 closes a long gap: PHP developers can bring legacy into block themes without React. The cost is a thinner editor UX and stale preview data. Strong for migration; for a complex new block, still choose JavaScript.

