Skip to main content

Site

Vasyl MartyniukLess than 1 minute

Syntax

Site:<ID>

Definition

Manage access to the entire sub-site in the WordPress Multi-site networkopen in new window setup.

In the example statement below, we restrict access to the entire sub-site with ID 2.

{
    "Statement": [
        {
            "Effect": "deny",
            "Resource": "Site:2"
        }
    ]
}

Conditioning access to a sub-site is helpful for access to sub-sites based on users attributes. For example, the statement below restricts access to any sub-site if a user is not a member.

{
    "Statement": [
        {
            "Effect": "deny",
            "Resource": "Site:${WP_SITE.blog_id}",
            "Condition": {
                "Equals": {
                    "(*boolean)${CALLBACK.is_user_member_of_blog}": false
                }
            }
        }
    ]
}

The is_user_member_of_blogopen in new window is the WordPress core function that finds out whether a user is a member of a given blog.