On the Cloudflare DNS tab change your A-records to a dummy IP.
Use IP: 220.127.116.11
Open the config file
and add the line:
Then add the route line:
route = "www.example.com/*"
You’d should prefix the domain with www according to this post.
Now you are ready to publish the static WordPress site with this command:
wrangler publish --env production
References about using a domain with Cloudflare Workers static WordPress