This guide is a continuation of the How To Add a Restriction Rule doc. We’ll cover adding groups of rules (i.e., nested rules). That means we’ll edit a global restriction, go to the Content tab, and click Add Group instead of Add Rule.
Here’s a sneak peek of what a group of content rules look like.
If you only want to add single rules, not groups of rules, read our How To Add a Restriction Rule article.
1. Create or edit a global restriction and click Content
If you need to learn how to create a global restriction, visit our A Quick Start to Your First Global Restriction doc.
2. Click Add Group
3. Enter a name for your new group
4. Add your Rules
Search for a rule to complete the first rule in your new group of rules.
From here, you can start adding rules connected by ORs and ANDs. To learn how ORs and ANDs work, read about using more than 1 rule.
5. Click Save Restriction to save your changes
You did it!
Example Group Scenario
If you’re new to group or nested content rules, let’s go through an example scenario. This example will give you an idea of when and how to use group rules.
Learning & Development Website
Let’s say we have a learning and development subscription website with these 2 posts:
- “How do I sign up?” for potential new subscribers (not yet signed up).
- “I’m new to your Learning program!” for brand new subscribers.
Categories and Tags
The “How do I sign up?” post is in a Welcome category with the tag newbies. The Welcome category is content for new visitors who haven’t subscribed yet.
The “I’m new to your Learning program!” post is in a Learning category with the tags beginner, how-to, and newbies. The Learning category is content for our program subscribers.
Our goal has 2 parts.
Part 1: Onboarding Posts
We want only new subscribers to see posts for new subscribers. I.e., if you just signed up to our site, you’ll get to read all our onboarding blog posts.
That means new subscribers must have access to posts in the Learning category AND have either of these tags:
Part 2: Onboarding Pages
Only subscribers can access our special “Onboarding Page” and “Learning and Development Page” pages.
Global Restriction Result
First Group: Getting Started Posts
The first rule restricts all posts with beginner, how-to, or newbies tags.
The second rule restricts all posts in the Learning or Development categories.
An AND operator connects the 2 rules. That means only subscribers can see posts in the Learning or Development categories tagged with beginner, how-to, or newbies.
That’s great. Part 1 is done! What about those 2 pages we said earlier (part 2)?
Here’s where we need to have a second group.
Second Group: Onboarding Pages
We need to connect our 2 groups with an OR operator. That’s because we want only subscribers to view all our onboarding posts or posts.
Using an AND operator here is a mistake because it creates a condition that isn’t possible in WordPress. Since the AND condition here isn’t possible, our rule will never fire (never take effect).
Here, we only need one rule to restrict the “Onboarding Page” and “Learning and Development Page”.
Using groups makes this example restriction possible. Without grouping (nesting) the rules above, we couldn’t restrict posts that fall into a certain category and tag while restricting certain pages at the same time.
It’s Your Turn
Now, it’s your turn. Let us know if you have any questions about adding group rules.
If you run into any problems: