Skip to content

Feature : Inserter Priority for Custom Blocks#75006

Closed
Vrishabhsk wants to merge 3 commits intoWordPress:trunkfrom
Vrishabhsk:add/block-inserter-order
Closed

Feature : Inserter Priority for Custom Blocks#75006
Vrishabhsk wants to merge 3 commits intoWordPress:trunkfrom
Vrishabhsk:add/block-inserter-order

Conversation

@Vrishabhsk
Copy link
Copy Markdown
Contributor

What?

Why?

Currently, block developers have no way to control where their blocks appear in the inserter relative to other blocks in the same category. This makes it difficult to surface important custom blocks prominently. The inserterPriority property gives developers control over block ordering within the inserter.

How?

  1. Added inserterPriority property to the block.json schema (schemas/json/block.json)
  2. Added inserterPriority to allowed fields in JS block registration (packages/blocks/src/api/registration.js)
  3. Modified the store reducer to merge bootstrapped data (packages/blocks/src/store/reducer.js)
  4. Added sorting logic in getInserterItems selector (packages/block-editor/src/store/selectors.js)
  5. Created PHP compat file to pass inserterPriority from server to client (lib/compat/wordpress-6.9/block-inserter-priority.php)

Blocks with lower inserterPriority values appear first. Default is 0.

Testing Instructions

  1. Create a plugin with a custom block that includes inserterPriority in its block.json:
    {
      "name": "my-plugin/priority-block",
      "title": "Priority Block",
      "category": "widgets",
      "inserterPriority": -10
    }
  2. Activate the plugin and open the block editor.
  3. Open the Block Inserter and navigate to the "Widgets" category.
  4. Verify the block with inserterPriority: -10 appears before other blocks in the category.
  5. In the browser console, verify:
    wp.data.select('core/block-editor').getInserterItems()
      .filter(i => i.name.startsWith('my-plugin/'))
      .map(i => `${i.name}: ${i.inserterPriority}`)

Testing Instructions for Keyboard

  1. Open the block editor and press / to open the slash inserter.
  2. Type a block name to filter results.
  3. Use arrow keys to navigate the list.
  4. Verify blocks are ordered by their inserterPriority value (lower values first).

Screenshots or screencast

Before: Blocks ordered by registration After: Blocks ordered by inserterPriority (lower values first)
Screenshot 2026-01-28 at 11 41 23 AM Screenshot 2026-01-28 at 11 41 02 AM

@github-actions
Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Vrishabhsk <vrishabhsk@git.wordpress.org>
Co-authored-by: groenroos <groenroos@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka
Copy link
Copy Markdown
Member

Mamaduka commented Feb 3, 2026

Thanks for contributing, @Vrishabhsk! Closing this based on the discussion in the issue.

@Mamaduka Mamaduka closed this Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Package] Blocks /packages/blocks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow custom blocks to influence display order in Inserter

2 participants