Allow commenting only for users from US country

In case you need to make sure only users from US can leave comments on your posts or simply to reduce the amount of spam, you can restrict anybody to post comments if he/she is not coming from US IP space.

This policy requires that you also have at least a free-tier ipstack service.

    "Version": "1.0.0",
    "Dependency": {
        "wordpress": ">=5.2.4",
        "advanced-access-manager": ">=6.3.3",
        "${CONST.AAM_IP_CHECK}": {
            "Name": "IP Check",
            "Version": ">=4.1.0",
            "URL": ""
        "${CONST.AAM_PLUS_PACKAGE}": {
            "Name": "Plus Package",
            "Version": ">=5.2.4",
            "URL": ""
    "Statement": [
            "Effect": "deny",
            "Resource": [
            "Action": [
            "Condition": {
                "NotEquals": {
                    "${IPSTACK.country_code}": "US"
Copy this unique number and use it to install the policy on your website. To learn more how it works, follow this link.
DEPENDENCIES List of required plugins for this policy to work properly.
WordPress >=5.2.4
Advanced Access Manager >=6.3.3
IP Check >=4.1.0
Plus Package >=5.2.4
ASSIGNEES The type of audience the policy is automatically applied to as well as excluded. To learn more how it works, follow this link
  • All Users, Roles & Visitors