Migrate WordPress to Cloudflare
The database stays where it is; only the code and media move. A normal host move means copying files, exporting and importing the database, fixing URLs and switching DNS, all at once. Moving to Cloudflare Workers with HostlessWP packages your WordPress, copies media to your bucket, connects the Worker to your existing MySQL and deploys to a test address. Your current host keeps serving the domain until you switch it, and switching back is a DNS change.
A host move vs this move
| Step | Moving to another host | Moving to Workers with HostlessWP |
|---|---|---|
| Files | Copy the whole folder over | Core, active theme, active plugins and translations are bundled at deploy |
| Database | Export, import, search and replace URLs | Stays put; reached through Hyperdrive |
| Media | Copied with the files | Copied to your S3-compatible bucket; nothing is ever deleted there |
| Logins | Usually kept if salts are copied | Kept: your keys and salts are deployed as a secret |
| Testing before the switch | A temporary URL or a hosts file edit | A workers.dev test address |
| Going back | The old server, if you still pay for it | Point the domain back; no data to copy |
Before you start
- Run the read-only report. In the folder with
wp-config.php, runnpx hostlesswp check. It lists your plugins against the tested list and flags what will not work. It changes nothing. - Turn on SSL for MySQL. Hyperdrive only connects over SSL. Or plan to use a Cloudflare Tunnel from your server.
- Create a bucket for media with a key that can read and write it: R2, S3, B2 or MinIO.
- Back up the database as you would before any change. hostlesswp only causes the writes a normal visitor would, but a fresh backup is cheap.
- Plan for email. PHP
mail()does not work on Workers. If your site sends mail that way, set up a mail plugin that sends over an HTTP API.
The move
Run the guided setup
On the machine with your site's files that can reach the database, usually your server over SSH, run
npx hostlesswp. It logs in to Cloudflare, asks how to reach the database, places the Worker next to it, checks the bucket, packages the site and deploys.Test the copy
Open the
*.workers.devaddress. Log in with your usual account, open the admin, submit your forms, place a test order if you run a shop.Switch the domain
When you are happy, add the domain to the Worker. Until then nothing has changed for your visitors.
Switching the domain
In the Cloudflare dashboard: Workers › your Worker › Settings › Domains & Routes, then add your domain. The domain has to be on Cloudflare for this. Your old host keeps serving the site until this step, so you choose when traffic moves.
After the switch, changes to content happen on Workers as usual: posts, pages, comments, orders, settings and media go to your database and bucket. Changes to code (plugins, themes, WordPress updates) are made on the source site and shipped with npx hostlesswp deploy.
Rolling back
Remove the domain from the Worker and point it back to your old host. The database never moved, so every post and order made on Workers is already there. The one thing to copy back is media uploaded while the site ran on Workers, which is only in your bucket.
Common blockers
| Blocker | What to do |
|---|---|
| "Hyperdrive could not connect" | Allow Cloudflare through the database firewall on the MySQL port, allow the user from remote hosts ('user'@'%') and turn on SSL. Or choose the tunnel. |
| Media folder was moved | Sites that set the UPLOADS constant or the upload_path option are stopped before deploying, with steps to move media back to wp-content/uploads. |
| Multisite | Not supported yet; hostlesswp stops before deploying. |
| Migration and backup plugins | Their admin pages load, but exports and backups to local disk do not persist on Workers. Keep them on the source site, or use remote storage (not tested). |
| Very heavy plugin stacks | Each instance has 128 MB of memory. Try the test address before switching. |
Questions
Do I need a migration plugin to move WordPress to Cloudflare?
No. HostlessWP reads your WordPress folder and database directly and deploys a copy to Cloudflare Workers. Migration and backup plugins that export to local disk do not work on the Workers side, because a Worker has no lasting disk.
Does my database move?
No. The database stays on its current host. The Worker reaches it through Cloudflare Hyperdrive, over SSL or a Cloudflare Tunnel.
Will my site go offline during the move?
Not before you switch the domain: until then your current host serves it and the copy runs on a test address. The switch itself is a change in the Cloudflare dashboard.
How do I move back?
Point your domain back to your old host. The database never moved, so nothing needs to be copied back. Media uploaded while the site ran on Workers is in your bucket.
Can I move a site from WordPress.com?
hostlesswp needs the site's files and direct access to its MySQL database, so it works with self-hosted WordPress. Move the site to a regular host first if it has neither.
Start with the read-only check
npx hostlesswp check tells you what will and will not work, and changes nothing.