WP Static Exporter for Cloudflare
HTMLS exporter for Wordpress
by Walter Mazzariol · github.com/waltermazzariol/wp-static-exporter · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/waltermazzariol/wp-static-exporter/archive/refs/heads/main.zipReadme
WP Static Exporter for Cloudflare Pages
Export your WordPress site as plain HTML and deploy it to Cloudflare Pages in minutes — no build tools, no CI/CD, no server required.
What it does
WP Static Exporter crawls your WordPress site from the inside and produces a fully self-contained folder of plain .html files with all assets — ready to drag into Cloudflare Pages Direct Upload.
No external services. No API keys. No CLI. Just install, configure, click Export, and download a ZIP.
Features
- Full site crawl — Homepage, all published Pages, Posts, custom post types, category and tag archives
- Asset bundling — Theme CSS, JavaScript, images (inline,
srcset, CSSbackground-image), web fonts - Uploads folder — Entire
wp-content/uploads/directory is included - Smart URL rewriting — All internal links are rewritten to root-relative paths
- Dev domain scrubbing — Removes hardcoded local/staging URLs (e.g.
http://site.local) from HTML, meta tags, OG tags, JSON-LD, and inline styles - CSS
url()safe handling — Inline background images instyle=""attributes are rewritten with single quotes to prevent HTML attribute corruption - Clean output — WordPress admin, login, feed, comment, and trackback URLs are excluded
- One-click ZIP download — Output is packaged and ready to upload to Cloudflare
Screenshots
| Admin page | Export in progress | Download ready |
|---|---|---|
| Settings and site overview | Live progress bar with status messages | One-click ZIP download with export log |
Requirements
| Requirement | Minimum |
|---|---|
| WordPress | 5.8+ |
| PHP | 7.4+ |
PHP ZipArchive extension |
Required (available on virtually all hosts) |
| WordPress accessible via HTTP | Required during export (no server-level password protection) |
Installation
Option A — Upload via WordPress admin (recommended)
- Download the latest release ZIP
- Go to Plugins → Add New → Upload Plugin
- Select the ZIP and click Install Now
- Click Activate Plugin
Option B — Manual install
cd /path/to/wp-content/plugins/
git clone https://github.com/waltermazzariol/wp-static-exporter.git
Then activate via Plugins → Installed Plugins.
Usage
1. Configure dev URL scrubbing (important)
If your site was built on a local domain (e.g. http://mysite.local, http://localhost), go to Tools → Static Exporter → Settings and add that URL to the Additional local / dev URLs to scrub field.
This is necessary because SEO plugins (Yoast, RankMath) store the dev URL in the database and embed it in og:image, twitter:image, and other meta tags. The exporter scrubs these automatically once you declare the dev domain.
http://mysite.local
Both http:// and https:// variants are scrubbed automatically from a single entry.
2. Export
Go to Tools → Static Exporter and click ⚡ Start Export.
The exporter will:
- Collect all public URLs
- Fetch each page and download all referenced assets
- Rewrite internal links to relative paths
- Scrub all declared local/dev URLs
- Copy the
wp-content/uploads/folder - Package everything into a dated ZIP file
Click ⬇ Download ZIP when complete.
3. Deploy to Cloudflare Pages
- Go to Cloudflare Dashboard → Pages → Create a project → Direct Upload
- Unzip the downloaded archive
- Drag the unzipped folder into the upload area
- Click Deploy site
- Configure your custom domain under Custom domains
What gets exported
| ✅ Included | ❌ Excluded |
|---|---|
| Homepage | /wp-admin |
| All published Pages | /wp-login |
| All published Posts | /wp-cron |
| Custom post types (public) | xmlrpc.php |
| Category archives | Feed URLs (/feed) |
| Tag archives | Comment and trackback URLs |
| Theme CSS & JavaScript | WordPress query-string URLs (?p=, ?s=, etc.) |
| Images (inline, srcset, CSS backgrounds) | |
| Web fonts referenced in CSS | |
Full wp-content/uploads/ |
Limitations
Static HTML cannot run server-side code. The following will not work after export:
- Search — requires PHP. Replace with Pagefind (static search) or Algolia.
- Contact forms — replace with Formspree, Netlify Forms, or a Cloudflare Worker.
- Comments — replace with Disqus or Giscus.
- WooCommerce / eCommerce — not compatible with static export.
- User login / membership areas — not compatible.
Everything purely content-based (text, images, CSS animations, JavaScript UI interactions) works perfectly.
Project structure
wp-static-exporter/
├── wp-static-exporter.php # Plugin bootstrap and constants
├── includes/
│ ├── class-exporter.php # Core crawl, asset download, URL rewriting, ZIP
│ ├── class-admin.php # Admin menu page and settings
│ └── class-ajax.php # AJAX handler for the export request
└── assets/
├── admin.css # Admin UI styles
└── admin.js # Progress bar and AJAX trigger
How it works
The exporter runs entirely inside WordPress — no headless browser, no external crawler.
- URL collection — queries WordPress for all public post types, terms, and the homepage via standard WP functions (
get_posts,get_categories,get_tags, etc.) - Page fetch — each URL is fetched via
wp_remote_get()from the live WordPress instance - Asset processing — the HTML is parsed with regex to find
<link>, `