| 开发者 | derickschaefer |
|---|---|
| 更新时间 | 2025年11月12日 11:33 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 6.8 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
index.html in any browser — it works completely offline.stcw_ prefix, satisfying the latest WordPress.org code scanning rules.stcw_before_file_save — Fires immediately before a static file is written to disk.$static_file (string) — Path to the file being saved.stcw_after_file_save — Fires after a static file is successfully written.$success (bool) — True on success.\
$static_file (string) — The saved file path.stcw_before_asset_download — Allows inspection or modification of asset URLs before download.$url (string) — The original asset URL.stcw_after_asset_download — Executes after each asset download completes.$dest (string) — Destination path.\
$url (string) — Original URL.stcw_before_asset_batch — Fires before an asynchronous asset download batch begins.stcw_after_asset_batch — Fires after each asynchronous asset batch completes.$processed (int) — Number of assets processed successfully.\
$failed (int) — Number of failed downloads./tools/ directory has been added to the plugin to organize optional developer resources.\
It currently includes:
performance-profiler.txt — A detailed guide describing how to install and use the optional Performance Profiler MU plugin for advanced benchmarking./tools/performance-profiler.txt developer documentation.stcw_remove_wp_head_tags and stcw_process_static_html) enable companion plugins and custom integrations, opening up possibilities for agencies, developers, and SaaS providers to extend the plugin without modifying core code.
wp scw enable – Enable static generationwp scw disable – Disable static generationwp scw status – View current status and statisticswp scw process – Process all pending assetswp scw clear – Remove all generated static fileswp scw zip – Create a ZIP archive of the site/wp-content/plugins/static-cache-wrangler/ or install via Plugins > Add New.Yes — Static Cache Wrangler captures the final rendered HTML, so it works with any theme, builder, or framework (Elementor®, Divi®, Gutenberg®, etc.).
No — it's designed as a lazy loader, generating static pages only on demand with minimal memory and CPU impact.
No — it never alters your WordPress database schema or adds tables.\ All plugin-related options, transients, and scheduled events are automatically removed upon uninstall.
Absolutely. The output is plain HTML and assets — deploy it on any web server, CDN, or open it directly in a browser.
Dynamic features like forms, comments, or live feeds won't function in the static version, but all rendered content and assets are preserved exactly.
Revisit the updated pages while generation is enabled, or run wp scw process to rebuild all static content.
Yes! You can customize file locations and behavior using constants in wp-config.php:
Change static files location:
define('STCW_STATIC_DIR', WP_CONTENT_DIR . '/my-static-files/');
Change assets location:
define('STCW_ASSETS_DIR', WP_CONTENT_DIR . '/my-assets/');
Disable async asset processing (process immediately):
define('STCW_ASYNC_ASSETS', false);
You can use WordPress filters to customize behavior:
Exclude specific URLs from generation:
add_filter('stcw_should_generate', function($should, $url) { if (strpos($url, '/private/') !== false) { return false; } return $should; }, 10, 2);
Modify HTML before saving:
add_filter('stcw_before_save_html', function($html) { return str_replace('</body>', '<footer>Generated: ' . date('Y-m-d') . '</footer></body>', $html); });
Version 2.0.5 removes the following WordPress-specific meta tags from static HTML:
data-wp-strategy attributes on script tags
These tags serve no purpose in static sites and removing them improves portability and security.Remove additional WordPress tags:
add_action('stcw_remove_wp_head_tags', function() { remove_action('wp_head', 'your_custom_action'); });
Modify HTML before saving:
add_filter('stcw_process_static_html', function($html) { // Add custom footer, remove tracking, etc. return $html; });
See the plugin documentation for 15+ complete examples.
No, but it's recommended. Existing static files will continue to work, but regenerating will give you the cleanest output with all WordPress meta tags removed:
wp scw clear
wp scw enable
Then browse your site to regenerate pages.
Yes! Version 2.0.5 introduces two hooks specifically designed for companion plugins:
stcw_remove_wp_head_tags - Remove additional WordPress tagsstcw_process_static_html - Modify final HTML output
These enable agencies, developers, and SaaS providers to build specialized extensions without modifying core plugin code.Yes! Version 2.0.5 is fully compatible with:
stcw_ prefix for WordPress.NamingConventions.PrefixAllGlobals complianceremove_action() with regex safety netdata-wp-strategy attributes from script tags for cleaner HTMLstcw_remove_wp_head_tags action hook - remove additional WordPress head tags before generationstcw_process_static_html filter hook - modify HTML output before saving to fileSTCW_Generator::remove_wordpress_meta_tags() method for centralized tag removalwp scw clear && wp scw enable)static-cache-generator → static-cache-wrangler to meet naming and trademark guidelines.STCG → STCW for consistent 4-character namespace compliance.scw (formerly scg) with backward compatibility removed for clarity..zip exports excluding dev files).wp scw)