Installation
Requirements
- bash 4 or newer
- curl and jq
- A Cloudflare account with a zone you can edit
- An API token with the permissions the Rulesets API needs
Clone the repository
git clone https://github.com/managingwp/cloudflare-wordpress-rules.git
cd cloudflare-wordpress-rules
chmod +x cfwr.sh cfwrv1.sh cfwrv2.sh cloudflare-token.sh cloudflare-turnstile.sh
The repository also ships short symlinks: cloudflare-wordpress-rules and
cfwpr both point at cfwr.sh, the version chooser. cfwrv1.sh is the stable
script and cfwrv2.sh is the single-file refactor; see
cfwr.sh for how to pick one.
Configure credentials
Every script reads ~/.cloudflare. Start from the commented template:
cp .cloudflare.example ~/.cloudflare
chmod 600 ~/.cloudflare
Then edit the file — see Authentication for the profile format and precedence rules.
Create rules on a zone
./cfwr.sh -d example.com -c create-rules default
default always resolves to the latest numbered release. To try the staging
rules instead, use the mwp-rules-beta selector:
./cfwr.sh -d staging.example.com -c create-rules mwp-rules-beta
Verify what is live
./cfwr.sh -d example.com -c list-rules
Commands that only read local profiles need no credentials at all:
list-profiles, print-profile <profile>, validate-profile <profile>, and
list-auth-profiles.
Next steps
- Commands reference — every command and option.
- Profile management — the beta → release workflow for rule changes.
- Multi-zone operations — run one command over many zones.