Skip to content

Block API #41236

Open
Open

Description

@gziolo

This overview issue collects an actionable list of impactful tasks that capture possible enhancements to the various Block APIs that exist to power the WordPress block editor.

Block API is intentionally a vague term reflected in the list of action items grouped into categories like block registration, block attributes, block interactions, block modification, etc. What’s in common is that the tasks included aim to resolve the most common friction points or increase the potential of the APIs offered for WordPress block, plugin, and theme authors. In effect, it makes it possible to fulfill the needs of developers wanting to adopt the block editor in their projects.

🛠️ = in development
🤚 = needs to be unblocked

❗Top Things

High-impact projects in active development:

📖 Backlog

Planned tasks that are being actively researched, waiting for developers to pick them up or on hold until they get unblocked.

Block Registration

Block Assets

Block assets are JavaScript (editorScript, script, viewScript) and CSS (editorStyle, style) defined in block.json file.

Block Attributes

Block Supports

Block Variations

Block Hooks

Content Modelling

Various

Developer Experience

Activity

  1. added
    [Feature] Block APIAPI that allows to express the block paradigm.
    [Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.
    on May 23, 2022
  2. pinned this issue on May 23, 2022
  3. added
    [Type] OverviewComprehensive, high level view of an area of focus often with multiple tracking issues
    on May 23, 2022
  4. luisherranz commented on May 23, 2022

    @luisherranz
    Member

    Develop strategies for loading JavaScript on the frontend - head vs footer, but also frontend hydration techniques explored in Implement different hydration techniques block-hydration-experiments#12.

    This can be a good first step, but acknowledging that we need more than that in the near future: probably asycn/defer (something like what @adamsilverstein proposed in WordPress/performance#168) or even do the jump to ESM.

    Apart from that, I think we should explore a mechanism to export different code depending on the context (Edit, Save, or Frontend): WordPress/block-interactivity-experiments#11

  5. gziolo commented on May 27, 2022

    @gziolo
    MemberAuthor

    Thank you @luisherranz for your feedback. I included your suggestions together with references.

    I also added two more items that I missed initially but have been following closely for a long time:

  6. fabiankaegy commented on Jul 20, 2022

    @fabiankaegy
    Member

    @gziolo I have reviewed the items that are already tracked here and I myself have created 3 issues recently that I think could all be added:

  7. unpinned this issue on Feb 7, 2023
  8. pinned this issue on Feb 11, 2023
  9. gziolo commented on Feb 13, 2023

    @gziolo
    MemberAuthor

    ☑️ Completed in WordPress 6.1 cycle

    Block Registration

    Block Assets

    Some of the details were tracked in #33542.

    Documentation

  10. 16 remaining items

  11. noisysocks commented on Jul 20, 2023

    @noisysocks
    Member

    Something that's been on my mind lately is how we have a lot of different APIs to do with restricting blocks:

    • The templateLock prop on InnerBlocks and templateLock block editor setting
    • The lock block attribute
    • The allowedBlocks prop on InnerBlocks and allowedBlocks block editor setting
    • The parent attribute in registerBlockType
    • The useBlockEditingMode hook

    I wonder if we can consolidate some of these APIs or otherwise make them more coherent. Perhaps something to think about in the context of Block API improvements.

  12. gziolo commented on Sep 5, 2023

    @gziolo
    MemberAuthor

    Update

    Top Things

    Completed during WP 6.3 & 6.4

    On hold

    Added

  13. gaambo commented on Sep 14, 2023

    @gaambo
    Contributor

    Regarding viewStyle: The initial issue was closed, therefore I'm posting this here:
    I actually think this would be great to have. Not having this assumes, frontend styles can be used 1:1 in the editor. I've encountered many situations where that's just not true - it has gotten a lot better with the apiVersion: 2 blocks, but there are still many cases where I want to enqueue a style only in the frontend. Examples:

    • Very complex blocks - where I will develop a very specific block editing experience in the editor with components and editor styles and want to load the "real" styles for the (dynamically) rendered block only in the frontend.
    • JavaScript-heavy frontend - the most basic example being slider. I will have a lot of CSS which only styles the JS-initialized version of the block and they just don't need to be loaded in the editor.
    • There are cases where the frontend styles are just not used in the editor (and I know that while developing), so it's a performance slow-down if you have many such blocks. But there are also cases where the frontend styles may just "destroy" the editing experience of a block because they just don't work in that context.

    Since we already have script, viewScript and editorScript I think it would keep clarity by also introducing viewStyle. Even if there are not many use cases where it's used, I don't see a real disadvantage.
    It would also mean, that all assets of a block in all contexts could be managed through block.json - which would be great.

  14. gziolo commented on Sep 14, 2023

    @gziolo
    MemberAuthor

    @gaambo, thank you for feedback.

    Regarding viewStyle: The initial issue was closed, therefore I'm posting this here:

    Can you share the link to the issue? I would like to learn why it was closed and potentially reopen. There is still an item listed in the Backlog that signals that we have this API on the roadmap but it doesn't link to the issue you referred to:

    "Introduce viewStyle for styles used only on the front end to align with scripts and viewScript."

  15. gaambo commented on Sep 15, 2023

    @gaambo
    Contributor

    Can you share the link to the issue? I would like to learn why it was closed and potentially reopen. There is still an item listed in the Backlog that signals that we have this API on the roadmap but it doesn't link to the issue you referred to:

    @gziolo
    I've found #33542 where viewStyle was mentioned. I can open a new issue if required and we can link it in this overview issue.

  16. gziolo commented on Sep 15, 2023

    @gziolo
    MemberAuthor

    I've found #33542 where viewStyle was mentioned. I can open a new issue if required and we can link it in this overview issue.

    It was me who closed the issue with the note I moved the item to this issue - the one I quoted in #41236 (comment) 😄

    If you could open a new issue that would be great, thank you! I'm happy to see this feature implemented if it's going to be useful for custom blocks.

  17. gziolo commented on Nov 3, 2023

    @gziolo
    MemberAuthor
  18. gziolo commented on Mar 15, 2024

    @gziolo
    MemberAuthor

    Update

    Completed during WordPress 6.5 cycle

    New

    Resources

  19. removed
    [Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.
    on Mar 21, 2024
  20. unpinned this issue on Jul 23, 2024
  21. pinned this issue on Aug 30, 2024
  22. gziolo commented on Oct 10, 2024

    @gziolo
    MemberAuthor

    Update

    Completed during WordPress 6.6 cycle

    Completed during WordPress 6.7 cycle

    New

    Resources

  23. gziolo commented on Jul 28, 2025

    @gziolo
    MemberAuthor
  24. mtias commented on Nov 28, 2025

    @mtias
    Member

    @gziolo I'd like to include this one here #65676

  25. cbravobernal commented on Dec 1, 2025

    @cbravobernal
    Contributor

    @gzioloImage I'd like to include this one here #65676

    @mtias , added to a new Block Hooks section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block APIAPI that allows to express the block paradigm.[Type] OverviewComprehensive, high level view of an area of focus often with multiple tracking issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions