WordPress
Pageflare works with static exports of WordPress sites. Plugins like Simply Static and WP2Static generate a flat directory of HTML, CSS, JS, and image files — exactly what pageflare expects.
Workflow
Section titled “Workflow”WordPress site ↓Static export plugin (Simply Static / WP2Static) ↓ exports to /var/www/static-export/pageflare /var/www/static-export/ --in-place ↓Deploy to CDN / S3 / Nginx / Cloudflare PagesWhy WordPress Exports Need Special Handling
Section titled “Why WordPress Exports Need Special Handling”WordPress injects a large number of tags into every HTML page that are irrelevant once the site is static:
- JSON-LD structured data bloat
- Emoji polyfill scripts and styles (loaded even when no emojis are present)
- oEmbed discovery links (unused in static exports)
- REST API (
wp-json) link headers and meta tags - Generator meta tags that expose the CMS and its version
- jQuery Migrate (a compatibility shim that is rarely needed)
- Shortlink tags
- WP global styles (often empty or contain only unused CSS variables)
Pageflare’s remove_wp_bloat option strips all of these automatically.
Step 1 — Export Your WordPress Site
Section titled “Step 1 — Export Your WordPress Site”Install and configure your export plugin:
- Simply Static: Go to Simply Static > Settings, set the destination to a local folder, then click Generate Static Files.
- WP2Static: Configure the output directory and run a full site export.
The export produces a directory like /var/www/static-export/ containing index.html, wp-content/, and other assets.
Step 2 — Install pageflare
Section titled “Step 2 — Install pageflare”npm install -g @pageflare/cliOr via curl:
curl -fsSL https://get.appz.dev/pageflare/install.sh | shStep 3 — Create pageflare.jsonc
Section titled “Step 3 — Create pageflare.jsonc”Create a config file in your export directory or in the directory where you run pageflare:
{ // Standard optimizations "minify_html": true, "minify_css": true, "minify_js": true, "js_defer": true, "lazy_images": true, "img_dimensions": true, "font_swap": true,
// WordPress-specific cleanup "remove_wp_bloat": true}Step 4 — Run pageflare
Section titled “Step 4 — Run pageflare”pageflare /var/www/static-export/ --in-placeThe --in-place flag writes the optimized files back to the same directory, overwriting the originals.
What remove_wp_bloat Removes
Section titled “What remove_wp_bloat Removes”| Item | Tag / element | Notes |
|---|---|---|
| Emoji detection script | <script> (wp-emoji-release.min.js) | Loads on every page even with no emoji |
| Emoji stylesheet | <style> / <link> (wp-emoji-styles) | Accompanies the emoji script |
| oEmbed discovery | <link rel="alternate" type="application/json+oembed"> | Not needed for static exports |
| RSS / Atom feed links | <link rel="alternate" type="application/rss+xml"> | Feed URLs are dead on static exports |
| REST API link | <link rel="https://api.w.org/"> | wp-json endpoint not present on static exports |
| RSD / EditURI | <link rel="EditURI"> | XML-RPC discovery, irrelevant for static |
| wlwmanifest | <link rel="wlwmanifest"> | Windows Live Writer manifest |
| Generator meta | <meta name="generator" content="WordPress ..."> | Exposes CMS and version |
| Shortlink | <link rel="shortlink"> | WordPress-generated short URLs |
| WP global styles | <style id="global-styles-inline-css"> | Removed only when empty or containing only -- custom property stubs |
| jQuery Migrate | <script> (jquery-migrate.min.js) | Compatibility shim, rarely needed on static exports |
Automating Re-Exports
Section titled “Automating Re-Exports”When your WordPress content changes, re-export and re-optimize. A simple shell script:
#!/usr/bin/env bashset -e
EXPORT_DIR="/var/www/static-export"
echo "Exporting..."# Trigger Simply Static export via WP-CLIwp simply-static run --allow-root
echo "Optimizing..."pageflare "$EXPORT_DIR" --in-place --no-progress
echo "Deploying..."# rsync to your server or upload to S3rsync -avz --delete "$EXPORT_DIR/" user@server:/var/www/html/Schedule with cron to run nightly:
0 2 * * * /path/to/optimize-wp-export.sh >> /var/log/pageflare.log 2>&1Deploying the Optimized Export
Section titled “Deploying the Optimized Export”Once optimized, deploy the export directory to any static host:
- Cloudflare Pages: See the Cloudflare Pages guide
- Nginx: Point the
rootdirective at the export directory - Amazon S3 + CloudFront: Sync with
aws s3 sync - Vercel: See the Vercel guide
Configuration Reference
Section titled “Configuration Reference”{ // Remove WordPress-specific injected tags and scripts "remove_wp_bloat": true,
// Standard HTML/CSS/JS optimizations "minify_html": true, "minify_css": true, "minify_js": true, "js_defer": true,
// Image optimizations "lazy_images": true, "img_dimensions": true,
// Font rendering "font_swap": true}See the Configuration reference for all available options.
Troubleshooting
Section titled “Troubleshooting”pageflare processes files but page styling breaks
remove_wp_bloat only removes the specific WordPress-injected elements listed above. If styles break, a theme stylesheet may have been accidentally minified in a way that conflicts. Check the --log debug output to identify which file changed.
jQuery Migrate removal breaks plugins
Some older WordPress plugins depend on jQuery Migrate even in static exports (e.g., via inline scripts that reference deprecated jQuery APIs). If removing jQuery Migrate breaks functionality, add the script URL to the exclude_scripts list in pageflare.jsonc:
{ "remove_wp_bloat": true, "exclude_scripts": ["jquery-migrate"]}oEmbed or feed links are needed
If you are running a hybrid static/dynamic setup where RSS feeds or oEmbed endpoints are still active, disable the specific removal by setting remove_wp_bloat to false and enable only the sub-options you want (see the Configuration reference for individual flags).