Title: Capo &#8211; Head Optimizer
Author: Rick Viscomi
Published: <strong>2026 年 8 月 19 日</strong>
Last modified: 2026 年 8 月 24 日

---

搜尋外掛

![](https://ps.w.org/capo-head-optimizer/assets/banner-772x250.png?rev=3655101)

![](https://ps.w.org/capo-head-optimizer/assets/icon-256x256.png?rev=3654916)

# Capo – Head Optimizer

 由 [Rick Viscomi](https://profiles.wordpress.org/rviscomi/) 開發

[下載](https://downloads.wordpress.org/plugin/capo-head-optimizer.0.1.4.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/capo-head-optimizer/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/capo-head-optimizer/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/capo-head-optimizer/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/capo-head-optimizer/#developers)

 [技術支援](https://wordpress.org/support/plugin/capo-head-optimizer/)

## 外掛說明

In standard WordPress sites, WordPress Core, themes, SEO plugins, analytics scripts,
and third-party plugins inject elements into `wp_head()` in arbitrary order. This
can lead to critical performance pitfalls:

 * **Delayed Title Tag Rendering:** SEO metadata and large JSON-LD blocks placed
   before `<title>`.
 * **Delayed Resource Discovery:** Preconnects, preloads, and async scripts pushed
   below dozens of CSS stylesheets.
 * **Render-Blocking Bottlenecks:** External synchronous scripts blocking CSS and
   parser execution.

**Capo solves this automatically.** By intercepting the page response via output
buffering, Capo uses a deterministic, stable sorting algorithm to reorder `<head
>` elements strictly according to browser critical rendering path priorities.

### The Capo Head Priority Spectrum

Capo organizes elements into 11 strict priority tiers (Weight 10 down to 0):

 1.  **Weight 10 (Critical Meta & Viewport):** `<base>`, `<meta charset>`, `<meta name
     ="viewport">`, critical `http-equiv` headers (CSP, origin-trial, accept-ch).
 2.  **Weight 9 (Title):** `<title>`.
 3.  **Weight 8 (Critical Resource Hints):** `<link rel="preconnect">`, `<link rel="
     preload" fetchpriority="high">`, `<link rel="modulepreload" fetchpriority="high"
     >`.
 4.  **Weight 7 (Async Script):** `<script src="..." async>`.
 5.  **Weight 6 (CSS @import Styles):** `<style>` blocks containing `@import` rules.
 6.  **Weight 5 (Sync / Inline Scripts):** Synchronous/inline JavaScript (`<script>`
     without defer/async).
 7.  **Weight 4 (Stylesheets & Style Blocks):** `<link rel="stylesheet">`, `<style>`
     blocks.
 8.  **Weight 3 (Standard Preload):** `<link rel="preload">`, `<link rel="modulepreload"
     >` (without `fetchpriority="high"`).
 9.  **Weight 2 (Defer Script):** `<script src="..." defer>`, `<script src="..." type
     ="module">`.
 10. **Weight 1 (Prefetch / Prerender):** `<link rel="prefetch">`, `<link rel="dns-
     prefetch">`, `<link rel="prerender">`, `<script type="speculationrules">`.
 11. **Weight 0 (Other Metadata):** OpenGraph, Twitter cards, Schema JSON-LD, RSS feeds,
     favicons, robots metadata.

### Features

 * **Zero Configuration:** Activate the plugin and your `<head>` is immediately 
   optimized.
 * **Deterministic Stable Sort:** Equal-weight elements retain their exact relative
   order, preserving CSS cascade specificity and JavaScript dependencies.
 * **Full Cache Compatibility:** Works seamlessly with WP Super Cache, W3 Total 
   Cache, WP Rocket, LiteSpeed Cache, and Cloudflare.
 * **Safe HTML Tokenizer:** Respects HTML comments, conditional comments (`<!--[
   if ...]>`), CDATA blocks, and inline script markup.
 * **Site Health & Admin Diagnostics:** Real-time `<head>` hygiene warnings and 
   diagnostic status in Tools > Site Health and Admin Toolbar.
 * **Testing & Bypass Mode:** Append `?capo=off` to any frontend URL to inspect 
   the un-reordered head.

## 螢幕擷圖

[⌊Capo reordering status visible in WordPress Site Health diagnostics.⌉⌊Capo reordering
status visible in WordPress Site Health diagnostics.⌉[

Capo reordering status visible in WordPress Site Health diagnostics.

[⌊Debug performance metrics comment in HTML source code.⌉⌊Debug performance metrics
comment in HTML source code.⌉[

Debug performance metrics comment in HTML source code.

## 安裝方式

 1. Upload the plugin files to the `/wp-content/plugins/capo-head-optimizer` directory,
    or install the plugin through the WordPress plugins screen directly.
 2. Activate the plugin through the **Plugins** screen in WordPress.
 3. If you use a page caching plugin (e.g. WP Super Cache, WP Rocket), clear/flush 
    your cache.

## 常見問題集

### Does Capo break script dependencies or stylesheet cascading?

No. Capo uses a deterministic stable sort. If you have multiple stylesheets (all
Weight 4) or multiple scripts (all Weight 5), they will maintain their exact original
relative order.

### Does Capo work with page caching plugins?

Yes. Capo works seamlessly with all full-page caching plugins (WP Super Cache, WP
Rocket, W3 Total Cache, Cache Enabler, LiteSpeed Cache, etc.) and edge caches (Cloudflare,
Fastly). When the cache is generated, the `<head>` is saved in its optimal order.

### Why does Capo place synchronous scripts before stylesheets?

Placing synchronous scripts before stylesheets ensures the browser’s preload scanner
can discover and download subsequent stylesheets concurrently while the script downloads.
If scripts follow stylesheets, execution is blocked until all stylesheets finish
loading.

## 使用者評論

這個外掛目前沒有任何使用者評論。

## 參與者及開發者

以下人員參與了開源軟體〈Capo – Head Optimizer〉的開發相關工作。

參與者

 *   [ Rick Viscomi ](https://profiles.wordpress.org/rviscomi/)

[將〈Capo – Head Optimizer〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/capo-head-optimizer)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/capo-head-optimizer/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/capo-head-optimizer/)，或透過
[RSS](https://plugins.trac.wordpress.org/log/capo-head-optimizer/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/capo-head-optimizer/)。

## 變更記錄

#### 0.1.4

 * Elevate high-priority preloads (`<link rel="preload" fetchpriority="high">` and`
   <link rel="modulepreload" fetchpriority="high">`) to Weight 8 (Critical Resource
   Hints) matching `@rviscomi/capo.js` v2.3.0.
 * Standard preloads without high priority remain in Weight 3 (Standard Preload)
   to avoid bandwidth contention against stylesheets.

#### 0.1.3

 * Added support for Speculation Rules API (`<script type="speculationrules">`) 
   classified as Weight 1 (Prefetch / Prerender) matching `@rviscomi/capo.js` v2.2.1.
 * Enhanced HTML tokenizer and attribute parsing to robustly preserve tags with `
   >` inside quoted attributes, boolean attributes, and empty string attributes.
 * Added full support for HTML conditional comments (`<!--[if ...]>`) and CDATA 
   sections in `<head>`.
 * Hardened Admin Toolbar diagnostic injection against regex backreference exploits
   using safe substring replacement.
 * Added pass-by-reference `$analysis` parameter and static accessor/reset methods
   to Parser for optimized memory lifecycle management.
 * Extended Site Health loopback check request timeout to 10 seconds via dynamic
   filter.
 * Consolidated test bootstrap harness and added CI matrix testing across PHP 7.4
   through 8.3.

#### 0.1.2

 * Adhered strictly to WordPress.org Plugin Directory guidelines and security standards.
 * Changed debug performance HTML comment to opt-in by default and removed external
   URLs.
 * Added uninstall.php handler to clean up database options on deletion.
 * Fixed PHP 7.4 backwards compatibility in origin trial subdomain validation.
 * Removed insecure sslverify override from Site Health loopback check.
 * Enforced 5-tag maximum limit in readme metadata.

#### 0.1.1

 * Added `<head>` validation engine with Origin Trial binary token decoding and 
   origin/expiry checks.
 * Added live page diagnostics to frontend WordPress Admin Toolbar with scrollable
   warnings dropdown.
 * Added HTML syntax highlighting and decoded token metadata table in WordPress 
   Site Health.
 * Improved toolbar integration and output buffering lifecycle.

#### 0.1.0

 * Initial public beta release.
 * Output buffering engine for automatic `<head>` reordering.
 * 1:1 parity with `@rviscomi/capo.js` rules and validation engine.
 * Site Health integration and bypass mode (`?capo=off`).

## 中繼資料

 *  版本 **0.1.4**
 *  最後更新 **2 週前**
 *  啟用安裝數 **10+**
 *  WordPress 版本需求 ** 6.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **7.0.4**
 *  PHP 版本需求 ** 7.4 或更新版本 **
 *  語言
 * [English (US)](https://wordpress.org/plugins/capo-head-optimizer/)
 * 標籤:
 * [head](https://tw.wordpress.org/plugins/tags/head/)[performance](https://tw.wordpress.org/plugins/tags/performance/)
   [seo](https://tw.wordpress.org/plugins/tags/seo/)[speed](https://tw.wordpress.org/plugins/tags/speed/)
   [web vitals](https://tw.wordpress.org/plugins/tags/web-vitals/)
 *  [進階檢視](https://tw.wordpress.org/plugins/capo-head-optimizer/advanced/)

## 評分

這個項目尚無任何評論記錄。

[撰寫評分](https://wordpress.org/support/plugin/capo-head-optimizer/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/capo-head-optimizer/reviews/)

## 參與者

 *   [ Rick Viscomi ](https://profiles.wordpress.org/rviscomi/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/capo-head-optimizer/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](https://rviscomi.dev/)