Skip to main content

PostType

Vasyl MartyniukLess than 1 minute

Beta 1

This is the documentation for the AAM 7.0.0-beta.1 release. We are actively working on the documentation that may change before stable release announcement.

Note!

Available only with the premium add-on.

Syntax

PostType:<post_type>:posts
PostType:<post_type>:term:<term_id|slug>:posts

The post_type has to be a valid post type slug registered with the core WordPress register_post_typeopen in new window function.

Definition

The PostType resource supports all the actions that the Post resource exactly the same way. It also support the ExcludeAuthors flag.

When there is a need to define the default access controls to all posts of any given post type, then the PostType:<post_type>:posts resource is the right choice for the job. Additionally, you can use the "Create" create to control the ability to create new posts within given post type.

For example, the statement below restricts the ability to create new posts.

{
    "Statement": {
        "Effect": "deny",
        "Resource": "PostType:post:posts",
        "Action": "Create"
    }
}

The following statement denies the ability to edit or even delete any existing pages.

{
    "Statement": {
        "Effect": "deny",
        "Resource": "PostType:page:posts",
        "Action": [
            "Edit",
            "Delete"
        ]
    }
}

When you need to set access controls to any specific term within a post type, use the PostType:<post_type>:term:<term_id|term_slug>:posts resource. This way, access controls will propagate only to posts that belong to specified term.

The example statement below denies managing posts in the "Science" category.

{
    "Statement": {
        "Effect": "deny",
        "Resource": "PostType:post:term:science:posts",
        "Action": [
            "Edit",
            "Publish",
            "Delete"
        ]
    }
}
Virtual Assistant