[WordPress] 外掛分享: Zero Blocks Given

首頁外掛目錄 › Zero Blocks Given
WordPress 外掛 Zero Blocks Given 的封面圖片
全新外掛
安裝啟用
尚無評分
16 天前
最後更新
問題解決
WordPress 6.0+ PHP 8.0+ v1.2.2 上架:2026-05-29

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.2.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Zero Blocks Given」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Most WooCommerce stores ship 80-150 KB of block CSS and JS that the store never actually renders. The WC BlockPatterns scanner is the one that bugs me most – it hits the filesystem on every request to scan a directory of pattern templates you don’t use. Then add core WP global-styles, wp-block-library and font-faces on top, and you’re loading a Gutenberg frontend you probably switched off a long time ago.
Zero Blocks Given turns it off at the source, through WooCommerce’s own dependency injection container. No CSS dequeue band-aid, no UI checkboxes, no PRO upsell. One constant in wp-config.php, pick a tier, done.
How it works
Here’s the thing – WC registers its block hooks as closures wrapping instance methods on container-managed objects. So you can’t remove_action() them by string. You have to fetch the same instance back from the DI container and pass it in as the callable. That’s what this does:
$bp = \Automattic\WooCommerce\Blocks\Package::container()->get( BlockPatterns::class );
remove_action( 'init', [ $bp, 'register_block_patterns' ] );

The DI-container path is the one that survives WC upgrades cleanly. String-callback matching and dequeue tricks tend to drift every release, so I went with the container.
Four modes. Three ways to set them.
Mode
What it turns off
When to use it
patterns
WC BlockPatterns directory scanner only
Block-based Cart/Checkout – keeps all blocks rendering, just skips the file-I/O scan
blocks
patterns + BlockTypesController + Notices styles + wc-blocks-style handle
Classic-shortcode WC stores
all
blocks + WP global-styles pipeline + theme.json + font-faces + head

文章
Filter
Apply Filters
Mastodon