Skip to content

PHP-only blocks in WordPress 7.1 #79330

Closed

Description

@priethor

Overall goal and scope

PHP-only blocks shipped in WordPress 7.0 (#71792), allowing PHP-oriented developers to register a block on the server without writing a JavaScript block implementation and giving features that currently live in shortcodes or meta boxes a clearer path into the block editor.

In this first iteration, a PHP-only block is registered with register_block_type() and rendered server-side; the editor just previews it through that callback and generates Inspector controls for a set of supported attributes.

The next round of work for 7.1 falls into three areas:

  • Polish rough edges in the shipped API, especially post context in editor previews and the missing block.json schema entry.
  • Improve the generated Inspector controls by consolidating them with the Block Fields system (today, a separate implementation) and adding richer field types like media, link, and rich text.
  • Explore making PHP-only blocks editable in the canvas.

Tasks

Nice to have

  • Add a how-to guide and a block-development-examples sample.
  • Stabilize the editor bootstrap mechanism currently exposed as window.__unstableAutoRegisterBlocks.

Open questions and decisions required

The current model previews the block server-side and keeps editable data in the Inspector: while this is enough for dynamic blocks, it is not a great editing model for blocks where the user expects to edit parts of the content directly in the canvas.

The main question for this cycle is whether PHP-oriented registration should support fixed markup with a few editable areas, and if so, how. There are two possible paths:

  • Pattern-based: define the block from an arrangement of regular blocks, where most of the structure is locked while a few areas are editable or bound to data: because those parts are just blocks, they can be edited in the canvas for free. This may need a new PHP registration surface, such as a template or pattern property on register_block_type.
  • innerContent-based: piggyback on the new exploration in #79115, which proposes the underlying innerContent support that would allow us to start from static HTML and place editable, locked block islands inside it. This may avoid the need for a dedicated pattern/template API, but the static HTML wrapping the editable blocks is not part of the block tree.

So lots of decisions and explorations ahead:

  • Decide which path to pursue, or how the two fit together if at all. The main risk is overlap: PHP-only blocks, content-only patterns, and synced patterns feel like variations of the same behavior and should converge rather than diverge further. Before adding another path, we need to check whether the existing mechanisms already cover the use cases. To inform the decision, we should:
    • Build a few representative PHP-only use cases with innerContent and document where it falls short in terms of PHP registration ergonomics.
    • Check whether content-only patterns already cover the pattern-based case.
    • Sketch how a PHP developer would declare static markup and editable parts without writing JavaScript.
  • Decide how generated controls should be grouped, especially Content vs Settings (depends on Block Attribute Groups #73845).
  • Decide how to proceed with the ToolsPanel refactor for generated controls (PR #75124).

Worth noting as out of scope: free-form, fully nestable inner blocks (#75794).

Activity

  1. self-assigned this
    on Jun 18, 2026
  2. added
    [Feature] Block API
    [Type] Iteration
    on Jun 18, 2026
  3. moved this to 📋 Iteration/Tracking Issues in WordPress 7.1 Editor Taskson Jun 19, 2026
  4. priethor commented on Jul 3, 2026

    @priethor
    ContributorAuthor

    Progress update July 3rd

    I explored both paths for in-canvas editing in response to the open questions above. Pattern-based registration came first (#79598), including support for content-only; I also prototyped innerContent as the authoring surface, but that support landed hardcoded to core/html and won’t be generalized (#79115, #79659), so it was out as a registration API for PHP-only blocks, and I didn’t even manage to push the exploration.

    That shaped a second, stacked PR (#79705), where authoring remained pattern-based, and the new innerContent component was reused only as the rendering engine to display the block’s PHP output in the editor, with the editable blocks inside it.

    In the end, I’ve closed both exploratory PRs and folded everything into #79831, which combines the best of both in a simplified version and is ready for review. Feedback is welcome!

  5. nickchomey commented on Jul 4, 2026

    @nickchomey
    Contributor

    I think you'd be interested in the PRs i've just opened to address #79765, which would add the ability to write full JS expressions right inside Interactivity API html attributes. So, combined with your efforts, you could make fully interactive blocks directly from PHP, no JS files required (though, obviously, some JS would be needed)

  6. t-hamano commented on Aug 12, 2026

    @t-hamano
    Contributor

    Since the 7.1 release is next week, can we close this issue and create a tracking issue for 7.2 if needed?

  7. nickchomey commented on Aug 12, 2026

    @nickchomey
    Contributor

    I've been very interested in the progression of this functionality, though it has been hard to follow as there's only been mentions of various experiments. I notice that there's a task above to write a 7.1 dev note that summarizes what has changed since 7.0 - has that been started anywhere? Nothing seems to have been mentioned in the 7.1 Field Guide either.

    On a related note, if a more formal tracking issue could be created for 7.2 (in due time), i'll be happy to help test and provide feedback.

  8. mcsf commented on Aug 13, 2026

    @mcsf
    Contributor

    priethor is on leave for a while, so this project is likely to move more slowly in the next cycle(s).

    Since the 7.1 release is next week, can we close this issue and create a tracking issue for 7.2 if needed?

    Yep. I'll close this one for now, and we'll see if there's bandwidth and appetite to work on this for 7.2.

    I notice that there's a task above to write a 7.1 dev note that summarizes what has changed since 7.0 - has that been started anywhere?

    I checked that box because I don't believe there's anything in 7.1 that needs a dev note (bug fix and schema fix).

  9. moved this from 📋 Iteration/Tracking Issues to ✅ Done in WordPress 7.1 Editor Taskson Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] Block API[Type] Iteration

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions