Skip to content
Firewall
Visit Firewall on GitHub
Set theme to dark (⇧+D)

Use category overrides to set WordPress rules to Block

Follow the steps below to deploy a managed ruleset and override rules for a specific category.

  1. Create a root ruleset if you do not already have one.
  2. Add a rule to your root ruleset that deploys a managed ruleset.
  3. Configure a category override that sets a specified action for all rules in a category.

The example below uses the create ruleset operation to execute the steps in a single POST request. If you already have a root ruleset, use a PUT request to update the setup.

  • Create a root ruleset.
  • Add a rule to the root ruleset that applies the Cloudflare Managed Ruleset to requests for example.com.
  • Override rules in the WordPress category to set the action to block.

The example below uses the Rulesets API to deploy a managed ruleset and override its behavior. This ensures rules in a specific category deploy a specific action. All other rules deploy with the defaults provided by the ruleset issuer.

curl -X POST "https://api.cloudflare.com/client/v4/accounts/{account-id}/rulesets" -d '{    "name": "My root ruleset",    "description": "Root ruleset for my account",    "kind": "root",    "rules": [{        "action": "execute",        "expression": "cf.zone.name eq \"example.com\"",        "action_parameters": {                "id": "{managed_Ruleset_ID}",                "overrides": {                    "categories": [                    {                        "category": "wordpress",                        "action": "block"                    }]                }        }    }],}'