[WordPress] 外掛分享: Patterndex – Pattern & Block Debugger

首頁 › 外掛目錄 › Patterndex – Pattern & Block Debugger
WordPress 外掛 Patterndex – Pattern & Block Debugger 的封面圖片
全新外掛
安裝啟用
—
尚無評分
剛更新
最後更新
—
問題解決
WordPress 6.6+ PHP 8.1+ v0.1.2 上架:2026-11-11

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.1.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Patterndex – Pattern & Block Debugger」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

A developer tool that adds two debugging surfaces to the block editor (post editor and site editor). Nothing is loaded on the front end, and nothing is loaded for users without the edit_posts capability.
Pattern browser
A pinnable Patterndex sidebar listing every pattern the editor knows about:

Registered patterns from the client stores (core, theme, plugin, pattern directory), plus user patterns (wp_block posts) with their sync status.
Search, plus source and category filters.
Per pattern: metadata (source, categories, block types, sync status, inserter visibility), a recursive block-usage count, copy name or content, a JSON dump, and a live preview.
A Server registry section backed by a REST endpoint that dumps the raw server-side WP_Block_Patterns_Registry and category registry, including patterns hidden from the inserter, exactly as PHP registered them.

Block debug panel
A Debug panel in the block inspector for the selected block, and the same panel as Selected block at the top of the sidebar. The sidebar copy matters: the block inspector renders no panels at all for synced pattern instances (core/block), so the sidebar is the only place they can be debugged.

Overview (name, client ID) with copy actions.
Dumps: block instance, block type, the wrapper element’s rendered DOM attributes, serialized block HTML.
Attributes editor: the block’s attributes as raw, validated JSON. Apply or reset; deleting a key removes the attribute; keys outside the block type’s attribute schema are flagged but allowed.
Pattern provenance: shows when the selected block is a synced pattern instance (core/block ref, wp_block record, per-instance overrides) or was inserted from a pattern (metadata.patternName), with dumps of the source pattern.

Access control
Every debug surface (editor assets and the REST endpoint) requires the view_patterndex capability, mapped to edit_posts by default. Remap it by filtering map_meta_cap at a priority above 0:
add_filter( 'map_meta_cap', function ( $caps, $cap ) {
if ( 'view_patterndex' === $cap ) {
$caps = [ 'manage_options' ];
}
return $caps;
}, 10, 2 );

Source code
The editor script is built from TypeScript with @wordpress/scripts. The source is included in this plugin under entries/, and the full project with build tooling is at github.com/danlapteacru/patterndex. To rebuild: npm install && npm run build.

延伸相關外掛

文章
Filter
Mastodon