What’s in This Guide
This guide covers how to choose what content to protect in your Global Restriction. This is the third of the 3 main steps for creating a Global Restriction.
Are you looking to protect a block instead of using a Global Restriction?
If you want to protect a block in the WordPress block editor, head over to our How To Add a Restriction to a Block guide.
What content is protected?
You’ll tell Content Control what content to protect by adding rules. If you don’t add any rules, Content Control does not restrict any content on your site by default.
You can even make a sequence of rules and string them along using AND and OR conditions (more on that later). If that’s not enough, you can make nested sequences of rules by adding groups of conditions.
Let’s start with adding 1 rule. We’ll use the home page as an example. I.e., you’ll get to see the home page if your global restriction allows you.
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 Rule
3. In the Search for a rule field, type “home page”
4. Click Content Is The Home Page, then click Save Restriction
Do you need more than 1 rule?
What if you want to restrict your home and sample pages (as an example)? Meaning only the roles you allow can view the home page or the sample page.
Add as many rules as you need!
No problem! You can add another rule.
You must join your rules with an “OR” or an “AND” condition. Let’s cover using ORs first.
You can even add groups of conditions to handle more complex or nested conditions.
Using ORs
Remember that rule you added earlier to protect the home page? Let’s also add an “OR” rule to protect the sample page.
Follow these steps.
1. Below your home page rule, click Add Rule
Make sure you have the OR setting between the first rule and this new rule.
2. Search for “selected page” and click Content Is A Selected Page
4 Search for “sample” and click Sample Page
5 Click Save Restriction
Here’s a demo of those steps.
After you hit Save Restriction, only people allowed to see the home page or sample page can view that content.
The opposite is true. Anyone not allowed to see the home page or the sample page cannot view that content.
Heads up!
It’s important to notice we don’t want to use AND here. If we used AND, this restriction would never fire (never take effect). That’s because the home page and sample page are different pages in our case. Since they are 2 different pages, you can bring up only one OR the other.
Let’s cover using ANDs next.
Using ANDs
In this example, you’ll want to create a new global restriction or edit a restriction, but “trash” all Content Rules first. In our scenario, we want to allow reviewers to review our draft post. We’ll need 3 things.
- A Drafts category
- A review tag
- A post that has both the Drafts category and review tag
After you add another rule, you can change the default OR to an AND. Look below for how that’s done.
Let’s get to it!
Follow these steps.
1. Click Add Rule to add your first rule
2. Search for Content Is A Post with Category
Pick the category you want. In our example, we chose Drafts.
3. Under your first rule, click Add Rule
Make sure you’re joining your first rule with the second rule using an AND condition.
4. Search for Content Is A Post with Tag
Pick the tag you want. In our example, we chose review.
You should have something like this now.
5. Click Save Restriction
Done! Now, your restriction protects any post in the Draft category with a review tag. Congrats!
Pro tip: To clone a restriction, you can first export the restriction you want to copy. Then, import it back in. Follow the steps in our How to Export and Import Global Restrictions guide.