Skip to main content
KadiCache
Core & Object CacheFree Core

Per-Page Script Manager (JS, CSS & ES Modules)

Opens a Zero-Reload Shadow DOM Aurora drawer directly inside any frontend page from the WordPress Admin Bar (Left Rail source filter, compact 36px rows, dynamic /uploads/ builder classification, universal Core Layout Guard, Testing Mode + signed 10-minute Guest Preview URLs, automatic Pro Cloud RUCSS/LCP sync, and AI MCP control).

Zero-Reload + AI MCP
JS + CSS + ESM
Verified Source Entry
apps/wordpress-plugin/src/Optimization/ScriptManager/AssetEnforcer.php
Verified Engine Capabilities

Engineered for zero regressions.

  • Zero-reload Shadow DOM Aurora drawer capturing 100% of Head & Footer JS, CSS, and WP 6.5+ ES Modules with dynamic /uploads/ builder/theme ownership
  • Universal Core Layout Guard flagging Theme CSS, >= 2 KB inline stylesheets, and active dependents — with inline KB warnings and protected bulk toggles
  • Testing Mode + signed 10-minute Guest Preview URLs (?kadicache_sm_preview=...) for incognito & AI verification without admin cookies, plus WP Admin 1-click Reset
  • Zero conflict with Delay JS, Minify, Early Cache, Pro Cloud RUCSS, or Pro Local LCP, plus sandboxed AI MCP manage_script_manager control
AI MCP Safe Script Audit Workflow
# 1. Inspect loaded JS, CSS & ES Modules on homepage
manage_script_manager { "action": "inspect_url", "url": "/" }
# 2. Simulate disabling Contact Form 7 everywhere except /contact/
manage_script_manager {
  "action": "simulate_rules",
  "rules": [{ "handle": "contact-form-7", "type": "js", "status": "disabled", "scope": "everywhere", "exceptions": { "urls": ["/contact/"] } }]
}
Inside the KadiCache WordPress Plugin

Per-Page Script Manager (JS, CSS & ES Modules) — Plugin Interface

3 live 2x Retina plugin screens
Frontend Admin Bar -> Script Manager (Zero-Reload Aurora Light Drawer)
MODULE 17 · 2X RETINA
Zero-reload Shadow DOM slide-down drawer matching KadiCache Aurora UI with instant Left Rail source filtering, 36px dense rows, dynamic /uploads/ classification, and automatic Core Layout safety badges.1366×820 WebP
100% Source-Code Verified7 min engineering readUpdated 2026-11-27
Executive Summary · 30-Second SpecZero-Regressions Spec
WP Admin Path
WordPress Admin Bar -> Script Manager (Zero-Reload Drawer; enable in KadiCache -> CSS & JavaScript)
Measured Impact
Zero-Reload Shadow DOM Drawer · Core Layout Guard · Signed Guest Preview · JS + CSS + ES Modules
Verification Marker
AssetEnforcer.php | AssetInspector.php | RuleStore.php | PageIdentity.php | ScriptManagerUi.php
  • Opens a Zero-Reload Shadow DOM Slide-Down Drawer directly inside any live page from the WordPress Admin Bar (matching KadiCache Aurora Light/Dark UI with Left Rail source filtering and compact 36px rows across every frontend page type).
  • Inspects and conditionally disables classic JavaScript ($wp_scripts), CSS ($wp_styles), and modern WordPress 6.5+ ES Script Modules (WP_Script_Modules), dynamically classifying compiled /wp-content/uploads/ builder/theme assets (Elementor, Divi, Bricks, Beaver Builder, Astra, Kadence) to their real owner.
  • Ships the universal Core Layout Guard (flags Theme CSS, stylesheets with >= 2 KB inline CSS, and active dependents; blocks bulk disable on Theme/Core), Testing Mode + Signed 10-Minute Guest Preview URLs (?kadicache_sm_preview=...), WP Admin 1-click Reset, and instant ?kadicache_sm_off=1 recovery.
  • Works cleanly alongside Delay JS, Defer JS, Minify, Early Page Cache, Pro Cloud RUCSS, and Pro Local LCP, and exposes full sandboxed AI control via MCP manage_script_manager (blocking critical layout removals and returning signed preview_url links + 1-click rollback checkpoints).
Table of Contents (5 sections)

Eliminate Site-Wide Plugin Asset Bloat Without Reloads or Accidental Layout Breaks#

Many WordPress plugins enqueue their JavaScript and CSS globally across every URL even when their form, slider, table, or block only appears on one page. KadiCache Script Manager (included 100% free in KadiCache Core v1.0.1+) adds a dedicated Script Manager button to the WordPress Admin Bar on every frontend page that slides down a Zero-Reload Shadow DOM Aurora Drawer right inside the page — zero ob_start() template wrapping, zero theme CSS leaks, and instant Left Rail source filtering across 90+ asset sites.

FIG 01Left Rail source navigator, compact 36px rows, Elementor /uploads/ grouping, and Core Layout safety badgesZoom 2x

Complete WordPress 6.5–6.9 Coverage + Smart /wp-content/uploads/ Ownership#

Unlike older script managers that only inspect $wp_scripts and $wp_styles (and dump compiled page-builder CSS into a generic bucket), AssetInspector.php captures Head and Footer assets across all three WordPress asset registries and dynamically resolves /wp-content/uploads/ owners:

  • Classic JavaScript ($wp_scripts): Includes local file sizes in KB, inline/localized payload sizes (wp_localize_script / wp_add_inline_script), and reverse dependency graphs (dependents).
  • Stylesheets ($wp_styles) + /uploads/ Builder Detection: Automatically groups compiled upload CSS from Elementor, Divi (et-cache), Bricks, Beaver Builder (bb-plugin), Oxygen, Breakdance, Avada (fusion-styles), Spectra, Brizy, Astra, Kadence, GeneratePress, WoodMart, Flatsome, and active themes under their true owner.
  • WordPress 6.5+ ES Script Modules (wp_script_modules()): Detects and conditionally dequeues Interactivity API and modern WooCommerce/Gutenberg block modules via wp_dequeue_script_module() and script_module_loader_src.

Universal Core Layout Guard & Signed Guest Preview URLs#

  • Core Layout Guard (is_critical_layout): Automatically labels Theme CSS, any stylesheet carrying >= 2 KB of attached inline CSS (like Elementor's kit/page styles or WP global-styles), and handles with active dependents. Shows exact inline KB stripped before disabling, skips critical handles during bulk Disable Group, removes Disable Group from Theme/Core/Other Local Assets, and requires confirmation when Testing Mode is off.
  • Testing Mode + Signed 10-Minute Guest Preview (?kadicache_sm_preview=...): Test rules privately without affecting visitors or Pro Cloud, and open the stateless HMAC-signed preview_url (no-store, noindex) in an Incognito browser or AI browser tool to inspect the exact guest render without needing an admin login cookie.
  • WP Admin Transparency: The CSS & JavaScript -> Per-Page Script Manager card surfaces any saved rules in the database with a 1-click Reset All Rules button.

Every Page Type Supported & Zero-Conflict Pro/Cloud Sync#

PageIdentity.php resolves the canonical route after WP_Query completes rather than relying on get_the_ID(), covering Front Pages, Blog Indexes, Singular Posts/Pages/Products/CPTs, WooCommerce Shop, Taxonomies, Author/Date, Search, 404, paginated /page/2/ views, virtual routes, and multilingual URLs. Because AssetEnforcer.php runs before output buffers, disabled assets never reach CssOptimizer, DelayJsOptimizer, or Pro Cloud RUCSS/LCP — and saving rules automatically invalidates FileCache, EarlyCache, Pro LearningRevision, Pro BrowserHintsStore, and ImageQueue.

Safe AI Control via OAuth 2.1 MCP (manage_script_manager)#

Connect Claude, Cursor, Antigravity, or ChatGPT to your WordPress site and run the built-in safe-script-audit guided prompt. The AI inspects assets via inspect_url, simulates rules in memory via simulate_rules (blocking HTTP failures, orphaned_dependents, and critical_layout_disabled removals), saves with an atomic McpCheckpoints snapshot + signed 10-minute preview_url when testing_mode: true, visually verifies the preview without needing admin cookies, and switches testing_mode: false only when verified.

Gergis — Lead Systems & Cache Architect
Principal WordPress & Cloud Edge Architect
E-E-A-T Source Verified

Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.

apps/wordpress-plugin/src/Optimization/ScriptManager/RuleStore.phpapps/wordpress-plugin/src/Optimization/ScriptManager/PageIdentity.phpapps/wordpress-plugin/src/Optimization/ScriptManager/AssetInspector.phpapps/wordpress-plugin/src/Optimization/ScriptManager/AssetEnforcer.phpapps/wordpress-plugin/src/Optimization/ScriptManager/ScriptManagerUi.php

Technical FAQ

Is Script Manager included in KadiCache Free Core?

Yes. Per-Page Script Manager (including the Admin Bar launcher, JS/CSS/ES Modules support, Dependency Guard, Testing Mode, Global Rules, and AI MCP control) is 100% free in KadiCache Core v1.0.1+.

Why does targeting Mobile Only or Desktop Only require Separate Mobile Cache?

Without Separate Mobile Cache, a single cached HTML file is shared by both mobile and desktop visitors. Requiring Separate Mobile Cache guarantees desktop visitors never receive mobile-stripped HTML or vice versa.

How do I recover immediately if a rule breaks page layout or functionality?

Append ?kadicache_sm_off=1 to any URL while logged in as an administrator to bypass all Script Manager rules on that request, or add define('KADICACHE_DISABLE_SCRIPT_MANAGER', true); in wp-config.php.