About this plugin
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):
- Weight 10 (Critical Meta & Viewport): <base>, <meta charset>, <meta name="viewport">, critical http-equiv headers (CSP, origin-trial, accept-ch).
- Weight 9 (Title): <title>.
- Weight 8 (Critical Resource Hints): <link rel="preconnect">, <link rel="preload" fetchpriority="high">, <link rel="modulepreload" fetchpriority="high">.
- Weight 7 (Async Script): <script src="..." async>.
- Weight 6 (CSS @import Styles): <style> blocks containing @import rules.
- Weight 5 (Sync / Inline Scripts): Synchronous/inline JavaScript ( <script> without defer/async).
- Weight 4 (Stylesheets & Style Blocks): <link rel="stylesheet">, <style> blocks.
- Weight 3 (Standard Preload): <link rel="preload">, <link rel="modulepreload"> (without fetchpriority="high" ).
- Weight 2 (Defer Script): <script src="..." defer>, <script src="..." type="module">.
- Weight 1 (Prefetch / Prerender): <link rel="prefetch">, <link rel="dns-prefetch">, <link rel="prerender">, <script type="speculationrules">.
- 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.