INTEGRITY Cloudflare Docs

Set WordPress rules to Block

Follow the steps below to create a rule that executes a managed ruleset and defines an override for rules with a specific tag.

  1. Add a rule to a phase entry point ruleset that executes a managed ruleset.
  2. Configure a tag override that sets a specified action for all rules with a given tag.

Zone-level example

This example uses the Update a zone entry point ruleset operation to perform the following two steps in a single PUT request:

Required API token permissions

At least one of the following token permissions is required:
Update a zone entry point ruleset
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/phases/http_request_firewall_managed/entrypoint" \
	--request PUT \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"rules": [
				{
						"action": "execute",
						"expression": "true",
						"action_parameters": {
								"id": "<MANAGED_RULESET_ID>",
								"overrides": {
										"categories": [
												{
														"category": "wordpress",
														"action": "block"
												}
										]
								}
						}
				}
		]
	}'

Account-level example

This example uses the Update an account entry point ruleset operation to perform the following two steps in a single PUT request:

Required API token permissions

At least one of the following token permissions is required:
Update an account entry point ruleset
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/rulesets/phases/http_request_firewall_managed/entrypoint" \
	--request PUT \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"rules": [
				{
						"action": "execute",
						"expression": "cf.zone.name eq \"example.com\" and cf.zone.plan eq \"ENT\"",
						"action_parameters": {
								"id": "<MANAGED_RULESET_ID>",
								"overrides": {
										"categories": [
												{
														"category": "wordpress",
														"action": "block"
												}
										]
								}
						}
				}
		]
	}'