Static Cache Wrangler is a lightweight, low‑resource
static site generator and
HTML export engine for WordPress. It automatically creates
self‑contained, URL‑agnostic static pages of your site — perfect for anyone who needs to
preserve, distribute, or accelerate WordPress content.
Originally developed as a command‑line tool for
WP‑CLI, it has evolved into composable, zero‑impact tooling that supports administrators, developers, and site owners alike. Whether you're archiving a client project, deploying to a CDN, or creating a portable offline version that runs anywhere, Static Cache Wrangler delivers fast, CDN‑ready HTML output without complex setup.
Technically, the plugin uses an
asynchronous, lazy‑loading build mechanism that generates static pages as visitors browse your site. Over time, your entire site is exported as lightweight static HTML.\
Free companion plugin
STCW Coverage Assistant adds real‑time build monitoring and manually triggered full‑site generation for any uncached pages.
Unlike traditional static‑site plugins that require full crawls or database schema changes,
Static Cache Wrangler is zero‑impact:
- Does not add custom database tables or modify your schema
- Automatically cleans up all plugin options, cron jobs, and transients upon uninstall
- Keeps your WordPress database completely untouched
- Runs all caching processes asynchronously in the background
-
Offers an optional performance profiler for granular resource and execution insights
Perfect for:
-
Creating fully offline or portable copies of WordPress sites
- Rsyncing to read‑only Nginx failover servers for high availability
- Publishing WordPress content to Amazon S3®, Netlify®, or other static CDNs
- Geo‑distributing static HTML for ultra‑fast global reads
- Archiving, demos, and secure client deliverables
- Small to mid‑sized sites (≈ 100 pages +) — upcoming assistant plugin expands this to 1 K pages
- Multisite administrators needing scalable static‑cache exports
A demo site created using this plugin can be found at Cache Wrangler Demo Site which is a static version of this WordPress site
Static Cache Wrangler turns WordPress into a fast, secure, and portable static‑site generator — with
no database changes,
no vendor lock‑in, and
no maintenance overhead.
Detailed Testing and Profiling:
- Triggering of page rendering requires 1-2MB of PHP memory for the duration of the process.
- Average processing duration is less than 500 ms (meaning memory consumption is quickly released)
- Average asset (JS, CSS, image) batch processing is less than 100 ms
- WordPress Core and theme rendering is generally 20-25 MB; SCW usage keeps total memory below 30 MB
-
CLI commands are even more efficient
Funding Model
-
This plugin and all companion plugins will remain 100% free (true WordPress style)
- Want to make a donation? Consider purchasing a copy of the author's book on command-line interfaces for yourself or as a gift.
Modern CLI Book
How It Works
- Enable static site generation using the toggle in the sidebar.
- As users browse your site normally, each page visit creates a static HTML file.
- Assets (CSS, JS, images, fonts) are automatically are queued and asyncronously downloaded and localized.
- Processing happens in the background and can be paused anytime.
- Use free companion plugin to monitor and accelerate cache creation STCW Coverage Assistant
- Download the complete static site as a ZIP file.
- Extract and open
index.html in any browser — it works completely offline.
Key Features
What's New in 2.1.2:
2.1.4
Version 2.1.4 adds STCW_META comment injection with WordPress post data (ID, post_type, permalink, dates, template) to support upcoming Headless Assistant companion plugin.
What's Fixed in 2.1.3:
2.1.3
Version 2.1.3 fixes errantly cached files and directories related to index.php and admin in URLs.
What's New in 2.1.2:
2.1.2
Version 2.1.2 introduces
configuration details in addition to
file locations on a key admin card.
What's New in 2.1.1:
2.1.1
Version 2.1.1 introduces
cache file timestamps,
staleness checks, and adds
sitemap creation to both the GUI and CLI zip file creation.
What's New in 2.1.0:
2.1.0
Version 2.1.0 introduces
static sitemap generation - a file system-based approach that creates sitemaps from your actual cached files rather than the WordPress database.
This update enables true static sitemaps that work in exported sites without WordPress, PHP, or a database connection - perfect for deployments to S3, Netlify, GitHub Pages, or any static hosting platform.
New WP-CLI Commands
wp scw sitemap - Generate sitemap.xml from cached static files
wp scw sitemap-delete - Remove sitemap files
Why File System-Based?
Traditional WordPress sitemap plugins (Yoast SEO, Rank Math) query the database dynamically. This works great for live sites, but fails for static exports because there's no PHP or database available.
Static Cache Wrangler scans your actual cached index.html files to build the sitemap, ensuring:
- Perfect accuracy - sitemap matches exported content exactly
- True portability - works without WordPress/PHP/database
- SEO compliance - search engines see what users see
- Deploy anywhere - S3, Netlify, GitHub Pages, any static host
Sitemap Features
- Generates sitemaps.org compliant XML sitemap
- Creates XSL stylesheet for browser viewing
- Calculates priorities automatically (homepage = 1.0, deeper pages = 0.4)
- Assigns smart change frequencies (homepage = daily, pages = monthly)
- Includes last modification times from file metadata
- Developer filter hook:
stcw_sitemap_changefreq
- Multisite compatible with isolated sitemaps per site
- Fast performance: ~50-100ms per 100 cached files
Typical Workflow
```
wp scw enable # Enable generation
Browse your site...
wp scw process # Process assets
wp scw sitemap # Generate sitemap (NEW!)
wp scw zip # Export with sitemap included
Deploy to S3/Netlify...
```
View in Browser
Open
https://your-site.com/sitemap.xml - the XSL stylesheet transforms it into a readable HTML table with color-coded priorities and sortable columns.
Technical Implementation
- New STCW_Sitemap_Generator class scans cached directory recursively
- Uses WordPress Filesystem API for all file operations
- Proper output escaping and sanitization throughout
- No database queries - pure file system operations
- Multisite compatible with isolated sitemaps per site
- Performance optimized: ~50-100ms per 100 files, ~2MB memory for 1,000+ pages
GUI Coming Soon
This release is CLI-only to validate the approach and gather user feedback. A visual interface in WordPress admin is planned for version 2.2.0.
Compatibility
- WordPress 6.8.3
- PHP 7.4, 8.0, 8.1, 8.2, 8.3
- Multisite compatible
- WP-CLI required for sitemap generation
What's New in 2.0.7:
2.0.7
Version 2.0.7 is a
major compatibility enhancement release, focused on improving support for Kadence Blocks and all Gutenberg block plugins that rely on dynamic JavaScript and CSS enqueues.
This update improves the accuracy of static exports by capturing
all front-end assets that WordPress prints dynamically—including those output by
wp_print_scripts() and
wp_print_footer_scripts()—ensuring that interactive block functionality is preserved outside of WordPress.
Compatibility Improvements
- Full Kadence Blocks compatibility – Global front-end scripts and CSS are now correctly captured, enabling buttons, accordions, icons, Lottie animations, progress bars, and other JS-driven components to function in static exports.
- Enhanced Gutenberg block support – STCW now reliably detects and exports front-end assets from all major block suites (Spectra, Stackable, GenerateBlocks, CoBlocks, Otter, etc.).
- Improved script capture logic – Dynamically enqueued scripts are now collected before theme rendering, eliminating missing-asset issues for blocks that load JS only when present on a page.
- Better preservation of front-end behavior – Assets required for tooltips, animations, scroll effects, responsive layouts, and block initialization are now exported consistently.
- Resolved blank-page edge cases – Updated capture timing ensures no interference with WordPress's script printing lifecycle, preventing rendering conflicts.
Technical Enhancements
- Added an early script-queue flush to collect output from:
wp_print_head_scripts()
wp_print_scripts()
wp_print_footer_scripts()
- Captured script output is appended to the main buffer before asset extraction, ensuring regex-based scanners detect dynamically enqueued JS/CSS.
- Improved compatibility with theme and plugin lifecycle order by isolating script capture from template rendering.
- Enhanced support for plugins that insert block assets conditionally based on block presence.
- Increased reliability of static exports for mixed-content layouts and advanced interactive block patterns.
WP-CLI Commands
Full control without the dashboard:
wp scw enable – Enable static generation
wp scw disable – Disable static generation
wp scw status – View current status and statistics
wp scw process – Process all pending assets
wp scw clear – Remove all generated static files
wp scw zip – Create a ZIP archive of the site
wp scw sitemap – Generate sitemap.xml from cached files
wp scw sitemap --target-url=<url> – Generate sitemap for deployment URL
wp scw sitemap-delete – Remove sitemap files
2.1.4
- Added: STCW_META comment injection with WordPress post data (ID, post_type, permalink, dates, template)
- Added:
scw_cache_metadata filter for extending metadata
- Enhanced: Cached HTML now includes authoritative WordPress data for headless CMS migrations
- Performance: Zero database queries, uses existing $post object (~200 bytes added to HTML)
2.1.3
- IMPROVED: Adds exclusions for index.php, username, and other bot cralwed URLs that were creating errant cache files.
- FIX: Version number corrected.
2.1.2
- NEW: Added configuration details in addition to file locations on main admin card
2.1.1
- NEW: Cache freshness system with automatic staleness detection
- NEW: Metadata stamps injected into all generated HTML files
- NEW: TTL-based expiry with configurable cache lifetime (default 24 hours)
- NEW: Automatic cache validation on every page request
- NEW: Plugin version tracking in metadata for upgrade detection
- NEW: Automatic sitemap generation when creating ZIP exports
- NEW: STCW_CACHE_TTL constant for configuring cache lifetime
- NEW: STCW_SITEMAP_URL constant for deployment URL configuration
- IMPROVED: Reduced unnecessary page regeneration by 90%+ when content hasn't changed
- IMPROVED: ZIP exports now always include fresh sitemap.xml automatically
- IMPROVED: Better resource utilization - only regenerates when truly needed
- IMPROVED: Smarter regeneration triggers (TTL expiry or plugin upgrade)
- IMPROVED: Enhanced logging for cache freshness decisions
- PERFORMANCE: Average 1-2ms overhead for staleness check (reads first 512 bytes only)
- PERFORMANCE: Zero regeneration cost for fresh files (immediate skip)
- PERFORMANCE: Typical 90%+ cache hit rate in production environments
- COMPATIBLE: WordPress 6.9, PHP 7.4-8.3
- FIX: Eliminated unnecessary regeneration on every page load
- FIX: Resolved race conditions when multiple requests hit same page
Cache Freshness System
Version 2.1.1 introduces intelligent cache freshness management that dramatically reduces server load by avoiding unnecessary page regeneration. Every generated HTML file now includes a metadata stamp tracking when it was created and which plugin version generated it.
How It Works:
- Each static HTML file contains metadata:
<!-- StaticCacheWrangler: generated=2025-12-04T15:30:00Z; plugin=2.1.1 -->
- On every page request, plugin checks if existing cached file is still fresh
- File is considered stale if: (1) metadata missing, (2) plugin version changed, or (3) age exceeds TTL
- Fresh files skip regeneration entirely - returning existing cached version
- Stale files trigger regeneration with fresh content and updated metadata
Configuration Options:
```php
// In wp-config.php
// Set cache lifetime (default: 86400 = 24 hours)
define('STCW_CACHE_TTL', 86400); // 24 hours (default)
define('STCW_CACHE_TTL', 3600); // 1 hour (aggressive)
define('STCW_CACHE_TTL', 604800); // 1 week (conservative)
define('STCW_CACHE_TTL', 0); // Never expire (version check only)
// Set sitemap URL for deployment (default: uses site URL)
define('STCW_SITEMAP_URL', '
https://static.example.com');
define('STCW_SITEMAP_URL', '
https://cdn.mysite.com');
```
Automatic Sitemap in ZIP Exports:
ZIP exports now automatically generate fresh sitemaps before packaging:
- No need to manually run
wp scw sitemap before wp scw zip
- Sitemap always reflects current cached content
- Uses configured STCW_SITEMAP_URL if deploying to different domain
- Seamless workflow:
wp scw zip includes everything
Performance Characteristics:
Typical production behavior over 24-hour cycle:
- Hours 0-23: "Cache fresh, skipping regeneration" (0ms overhead)
- Hour 24: "TTL exceeded, marking stale" → Regeneration (~50-500ms)
- After plugin upgrade: Immediate regeneration on next request
- Result: ~90% reduction in unnecessary regeneration
Real-World Example from Production Logs:
```
[04-Dec-2025 11:21:57 UTC] TTL exceeded, marking stale: index.html (age: 121938s, ttl: 86400s)
[04-Dec-2025 11:21:57 UTC] Cache stale, regenerating: index.html
[04-Dec-2025 11:21:57 UTC] Successfully saved: index.html
[04-Dec-2025 11:22:29 UTC] Cache fresh, skipping regeneration: index.html
[04-Dec-2025 11:24:11 UTC] Cache fresh, skipping regeneration: index.html
[04-Dec-2025 11:45:06 UTC] Cache fresh, skipping regeneration: index.html
... (50+ cache hits before next regeneration)
```
Migration Notes:
- No breaking changes - fully backward compatible with 2.1.0
- Pre-2.1.1 cached files without metadata automatically regenerate once (get fresh stamps)
- After initial regeneration, normal TTL-based freshness checking applies
- No manual intervention required
Why This Matters:
Before v2.1.1: Every page request regenerated HTML even when nothing changed\
After v2.1.1: Only regenerate when content is actually stale (24h+ old or plugin upgraded)
Result: Massive reduction in CPU usage, memory consumption, and page generation time for sites with moderate to high traffic.
Use Cases:
Development (1-hour TTL):
php
define('STCW_CACHE_TTL', 3600); // See changes within an hour
Staging (6-hour TTL):
php
define('STCW_CACHE_TTL', 21600); // Balance freshness vs. performance
Production (24-hour TTL - default):
php
// No configuration needed - 24 hours is sensible default
High-availability failover (1-week TTL):
php
define('STCW_CACHE_TTL', 604800); // Very stable, rarely regenerate
Archive/preservation (never expire):
php
define('STCW_CACHE_TTL', 0); // Only regenerate on plugin upgrades
Technical Implementation:
Staleness detection is highly optimized:
- Reads only first 512 bytes of cached file (not entire file)
- Regex pattern:
/<!--\s*StaticCacheWrangler:\s*generated=([^;]+);\s*plugin=([^\s;]+)\s*-->/
- Validates timestamp format (ISO 8601)
- Compares plugin versions (semantic versioning aware)
- Calculates age and compares against TTL
-
Decision made in ~1-2ms average
No external storage required:
-
No database tables
- No WordPress options
- No transients
- No cron jobs
- Metadata lives in HTML files themselves (self-contained)
Developer Benefits:
The cache freshness system enables sophisticated workflows:
- Rsync to failover servers with confidence files are current
- Deploy to CDN knowing cache reflects recent WordPress state
- Monitor cache hit rates via debug logs
- Tune TTL per environment for optimal balance
- Zero-impact when cache is fresh (no database queries, no filesystem writes)
= 2.1.0 =
2.1.0
- NEW: Static sitemap generation from cached files (CLI-only)
- NEW:
wp scw sitemap command generates sitemap.xml and sitemap.xsl
- NEW:
wp scw sitemap-delete command removes sitemap files
- NEW: File system-based approach - scans cached files instead of database
- NEW: Automatic priority calculation based on URL depth
- NEW: Smart change frequency assignment (homepage = daily, pages = monthly)
- NEW: XSL stylesheet for browser-viewable sitemaps
- NEW: Developer hook:
stcw_sitemap_changefreq filter for customization
- IMPROVED: Sitemaps work in static exports without WordPress/PHP/database
- IMPROVED: Perfect accuracy - sitemap reflects actual exported content
- IMPROVED: Multisite compatible with isolated sitemaps per site
- PERFORMANCE: ~50-100ms scan time per 100 cached files, ~2MB memory for 1,000+ pages
- FIX: Fixed CSS mismatches resulting in admin card layout
- COMPATIBLE: WordPress 6.8.3, PHP 7.4-8.3
- NOTE: GUI interface planned for v2.2.0 (currently CLI-only)
Why File System-Based?
Traditional WordPress sitemap plugins (Yoast SEO, Rank Math) query the database dynamically. This works great for live sites, but fails for static exports because there's no PHP or database available. Static Cache Wrangler scans your actual cached index.html files to build the sitemap, ensuring perfect accuracy and true portability.
Sitemap Features
- Generates sitemaps.org compliant XML sitemap
- Creates XSL stylesheet for browser viewing
- Calculates priorities automatically (homepage = 1.0, deeper pages = 0.4)
- Assigns smart change frequencies based on URL patterns
- Includes last modification times from file metadata
- Multisite compatible with isolated sitemaps per site
-
Fast performance: ~50-100ms per 100 cached files
New WP-CLI Commands
-
wp scw sitemap - Generate sitemap from cached files
wp scw sitemap-delete - Remove sitemap files
Typical Workflow
wp scw enable # Enable generation
wp scw process # Process assets
wp scw sitemap # Generate sitemap (NEW!)
wp scw zip # Export with sitemap included
View your sitemap at
https://your-site.com/sitemap.xml - the XSL stylesheet transforms it into a readable HTML table.
Technical Implementation
- New STCW_Sitemap_Generator class scans cached directory recursively
- Uses WordPress Filesystem API for all file operations
- Proper output escaping and sanitization throughout
- Developer filter hook for customization
- No database queries - pure file system operations
- GUI interface planned for version 2.2.0
= 2.0.7 =
- Major Compatibility Enhancement Release
- Version 2.0.7 delivers extensive improvements to Kadence Blocks support and significantly enhances compatibility with all Gutenberg block plugins that rely on dynamically printed JavaScript and CSS.
-
Ensures accurate static exports by capturing all front-end assets output by WordPress during rendering—including assets printed via
wp_print_scripts() and wp_print_footer_scripts()—preserving full block interactivity outside of WordPress.
Compatibility Improvements
-
Full Kadence Blocks compatibility – Global front-end scripts and styles are now correctly captured, enabling complete functionality for JS-dependent components (accordions, buttons, icons, Lottie animations, progress bars, etc.).
- Enhanced Gutenberg block suite support – Reliable detection and export of dynamic assets from Spectra, Stackable, GenerateBlocks, CoBlocks, Otter, and other major block libraries.
- Improved dynamic script capture logic – Scripts enqueued conditionally based on block presence are now collected earlier, preventing missing-asset issues.
- Better preservation of interactive behavior – Tooltips, animations, scroll effects, responsive scripting, and block initialization logic now export more consistently.
-
Resolved rare blank-page rendering issues caused by timing conflicts in WordPress’s script-printing lifecycle.
Technical Enhancements
-
Implemented an early script-queue flush to capture output from:
wp_print_head_scripts()
wp_print_scripts()
wp_print_footer_scripts()
- Captured script output is now injected into the main buffer before asset parsing, ensuring regex scanners detect all JS/CSS printed during rendering.
- Improved isolation of script-capture routines from theme templates to avoid lifecycle interference.
- Better support for plugins that enqueue front-end assets only when specific blocks are present.
-
Increased reliability for mixed-content layouts and advanced interactive block patterns.
Compatibility
-
Tested with WordPress 6.9 and PHP 8.3.6
-
Fully backward compatible with 2.0.6
Migration Notes
-
No configuration changes required.
- Recommended: Regenerate static exports after update to ensure full compatibility with updated asset-capture behavior.
2.0.6
- WordPress.org Compliance Release – “Moving Goal Post”
- Version 2.0.6 is a WordPress.org compliance update ensuring full compatibility with the latest repository validation standards introduced in 2025
- Implemented prefix standardization – all template variables, global references, and filters now use the
stcw_ prefix for WordPress.NamingConventions.PrefixAllGlobals compliance
- Achieved 100% pass on the updated “Check Plugin” API validation scans
- Enhanced namespace isolation and improved code safety for plugin interoperability
- Improved inline documentation for better code clarity and compliance traceability
- Developer Enhancements
- Introduced new developer hooks to support the forthcoming Static Cache Wrangler Performance Profiler MU plugin available here: Performance Profiler
- Added foundations for advanced performance profiling and benchmarking via WP‑CLI integration
- Enhanced developer experience with cleaner structure for extending cache behavior
- Improvements
- Non‑functional update focused on long‑term maintainability and ecosystem compliance
- Verified adherence to current WordPress.org repository and coding‑standards checks
- Refined internal structure to support future diagnostic and profiling modules
- Compatibility
- Tested with WordPress 6.8.3 and PHP 7.4 – 8.3
- Fully backward compatible with 2.0.5
- Migration Notes
- No functional changes to caching logic
- Recommended: Regenerate static files after update for clean metadata
2.0.5
- Enhanced Static HTML Output
- Implemented hybrid WordPress meta tag removal using native
remove_action() with regex safety net
- Removed 7+ WordPress-specific meta tags from static output (RSD, wlwmanifest, shortlinks, generator, REST API, oEmbed discovery)
- Stripped
data-wp-strategy attributes from script tags for cleaner HTML
- Reduced HTML file size by 3.1% and generation time by 2.3%
- Improved security by hiding WordPress version information from static exports
- New Developer Hooks
- Added
stcw_remove_wp_head_tags action hook - remove additional WordPress head tags before generation
- Added
stcw_process_static_html filter hook - modify HTML output before saving to file
- Added
STCW_Generator::remove_wordpress_meta_tags() method for centralized tag removal
- Improvements
- Enhanced code documentation with comprehensive PHPDoc comments
- Better extensibility for companion plugins and theme integration
- Follows WordPress coding standards and best practices
- More maintainable code with clear separation of concerns
- Compatibility
- Tested with WordPress 6.8.3
- Compatible with PHP 7.4, 8.0, 8.1, 8.2, 8.3
- Works with all major themes, page builders, and SEO plugins
- Migration Notes
- No breaking changes - fully backward compatible with 2.0.4
- Recommended: Clear and regenerate static files for cleanest output (
wp scw clear && wp scw enable)
- Optional: Review new hooks for customization opportunities
2.0.4
- Major WordPress.org Compliance & Refactor Release\
This update brings the plugin fully in line with current WordPress.org Plugin Directory requirements and coding standards. Nearly every internal file, reference, and namespace was audited, renamed, or rewritten for long-term maintainability and compliance.
- Plugin slug, text domain, and directory renamed from
static-cache-generator → static-cache-wrangler to meet naming and trademark guidelines.
- All file, class, and function prefixes updated from
STCG → STCW for consistent 4-character namespace compliance.
- Text domain and translation calls unified across all PHP files for proper i18n validation.
- Folder structure and includes modernized for autoloading consistency and WP.org scanning compatibility.
- Admin interface and view templates refactored for cleaner markup and translation readiness.
- CLI namespace and command base confirmed as
scw (formerly scg) with backward compatibility removed for clarity.
- All GitHub and asset references updated to reflect the new canonical project name and repository.
- Packaging and distribution scripts updated for compliance (clean
.zip exports excluding dev files).
- BREAKING CHANGE: Sites upgrading from earlier builds must deactivate the old “Static Cache Generator” plugin, delete it, and install/activate “Static Cache Wrangler.”
Data and generated files can be safely regenerated once activated.
2.0.3
- WordPress.org Compliance Update
- Changed all PHP prefixes from SCG_ to STCW_ (4+ character requirement)
- Properly enqueued all scripts and styles (removed inline code)
- Extracted CSS to admin/css/admin-style.css
- Extracted JavaScript to admin/js/admin-script.js and includes/js/auto-process.js
- WP-CLI commands unchanged for user convenience (still
wp scw)
- BREAKING CHANGE: Requires clearing and regenerating static files after update
- All option names changed (scw_enabled → stcw_enabled, etc.)
- All WordPress hooks changed (scw_process_assets → stcw_process_assets, etc.)
- See full migration guide on GitHub for technical details
2.0.2
- Enhanced stability and performance
- Improved CLI feedback and logging
- Refined asset handling and path rewriting
- Clean uninstall now clears all options, transients, and cron events
- Minor UI and accessibility improvements
2.0
- Complete rewrite with modern coding standards
- WP_Filesystem support for all operations
- Stronger security and sanitization
- Modern admin UI with real-time asset tracking
- Full WP-CLI integration
- Fixed Plugin Check and PHPCS compliance
1.0