Allow users to create and manage only one page

Limit users to be able to create and manage only one page that they’ve created. All other pages will not be visible.

Note! This policy does not define any capabilities that actually grant access for users to be able to manage pages. The additional policy can be applied to assign all the necessary capabilities. Refer to the “Allow to create and manage own pages” policy for more information.

The policy comes with three default values that can be adjusted to your specific needs:

  • threshold (default “1”) – number of pages that user is allowed to create;
  • postType (default “page”) – type of post records to limit;
  • publicOnly (default “true”) – status of post records that is taken in consideration. If “true” – then published only and if “false” then private only;

Note! If a user created a maximum allowed number of posts, the “Add New” button, and submenu item will no longer be available. However, if the user deletes any of the existing posts, this would put him back under the threshold and the user will be able to create a new post.

{
    "Version": "1.0.0",
    "Dependency": {
        "wordpress": ">=5.0.0",
        "advanced-access-manager": ">=6.3.3",
        "aam-enhanced-access-policy": {
            "Name": "AAM Enhanced Access Policy",
            "URL": "https://aamplugin.com/dw/aam-enhanced-access-policy.zip",
            "Version": ">=0.0.1",
            "GitHub": "https://github.com/aamplugin/aam-enhanced-access-policy"
        },
        "${CONST.AAM_PLUS_PACKAGE}": {
            "Name": "Plus Package",
            "Version": ">=5.3.0",
            "URL": "https://aamplugin.com/pricing/plus-package"
        }
    },
    "Statement": [
        {
            "Effect": "deny",
            "Resource": "PostType:page:posts",
            "Action": "Create",
            "Condition": {
                "GreaterOrEquals": {
                    "${CALLBACK.AAM\AddOn\EnhancedAccessPolicy\Author\Content::getPostCount}": "${POLICY_META.threshold}"
                }
            }
        },
        {
            "Effect": "deny",
            "Resource": "PostType:${POLICY_META.postType}:posts",
            "Action": [
                "ListToOthers",
                "EditByOthers",
                "PublishByOthers",
                "DeleteByOthers"
            ]
        },
        {
            "Effect": "allow",
            "Description": "WordPress core has a bug that prevents from accessing All Pages if edit_posts capability is not assigned.",
            "Resource": [
                "Capability:edit_posts",
                "BackendMenu:menu-edit.php?post_type=page"
            ]
        },
        {
            "Effect": "deny",
            "Resource": [
                "PostType:post:posts:edit",
                "BackendMenu:*"
            ]
        }
    ],
    "Param": [
        {
            "Key": "EnhancedAccessPolicy:Author:Content:PostType",
            "Value": "${POLICY_META.postType}"
        },
        {
            "Key": "EnhancedAccessPolicy:Author:Content:PublicOnly",
            "Value": "(*bool)${POLICY_META.publicOnly}"
        }
    ]
}
POLICY ID
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.0.0
Advanced Access Manager >=6.3.3
AAM Enhanced Access Policy >=0.0.1
Plus Package >=5.3.0
ASSIGNEES The type of audience the policy is automatically applied to as well as excluded. To learn more how it works, follow this link

This policy does not apply to any role, user or visitors. You need to attach this policy to desired audience manually. Learn more here.