Skip to content

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.

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 Pages

Why 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.

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.

Terminal window
npm install -g @pageflare/cli

Or via curl:

Terminal window
curl -fsSL https://get.appz.dev/pageflare/install.sh | sh

Create a config file in your export directory or in the directory where you run pageflare:

pageflare.jsonc
{
// 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
}
Terminal window
pageflare /var/www/static-export/ --in-place

The --in-place flag writes the optimized files back to the same directory, overwriting the originals.

ItemTag / elementNotes
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

When your WordPress content changes, re-export and re-optimize. A simple shell script:

optimize-wp-export.sh
#!/usr/bin/env bash
set -e
EXPORT_DIR="/var/www/static-export"
echo "Exporting..."
# Trigger Simply Static export via WP-CLI
wp simply-static run --allow-root
echo "Optimizing..."
pageflare "$EXPORT_DIR" --in-place --no-progress
echo "Deploying..."
# rsync to your server or upload to S3
rsync -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>&1

Once optimized, deploy the export directory to any static host:

  • Cloudflare Pages: See the Cloudflare Pages guide
  • Nginx: Point the root directive at the export directory
  • Amazon S3 + CloudFront: Sync with aws s3 sync
  • Vercel: See the Vercel guide
pageflare.jsonc
{
// 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.

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).