How rules work
A rule says who can see a piece of content. Rules are read from the top of the list down, and the first rule that covers a piece of content decides, whichever way it decides. This page explains every option of the rule screen and how the list works.
Who can see it
Pick the group that keeps access. Everyone outside it is stopped.
| Option | Who gets in | Version |
|---|---|---|
| Anyone with an account | Visitors who are logged in, whatever their role. | Free |
| Only visitors who are not logged in | The opposite: useful for a sign-up page that should disappear once someone has an account. | Free |
| Only certain roles | Logged in users with at least one of the roles you tick below the option. | Pro |
A role is the type of account a user has in WordPress (Administrator, Editor, Subscriber, or roles added by other plugins, such as Customer in WooCommerce). If you choose Only certain roles, tick at least one role. A rule with no role ticked is not saved: you see The rule was not saved: a rule for certain roles needs at least one role. Tick a role, or pick another option.
What it covers
Anything not covered stays public. You can combine the options.
- Content types: tick a whole type, for example Pages, Posts or a type added by another plugin (such as Products).
- Single items, by ID: type one or more IDs separated by commas, for example
12, 48, 105. The ID is the number afterpost=in the address bar while you edit a page. - Categories, tags and other terms (Pro): tick one or more terms. Any content that carries at least one of them is covered, whatever its type, including posts you add to that category later. Terms of any taxonomy (a taxonomy is a way of grouping content, such as categories, tags, or product categories added by another plugin) are listed.
- The whole site: the whole front end of the site, meaning every page and post, the home page (also when it shows your latest posts), archives, category pages and search results. This is how you put a site behind a login while it is being built. Administrators still get in.
With The whole site, some addresses always stay open so nobody gets stuck: the WordPress login page, the page the rule redirects to or shows in place of the content, the REST API and the dashboard. On pages that list posts (archives, search, the home page with your latest posts) there is no single content to replace, so a rule set to show a message shows it on a page of its own, and a rule set to show another page shows that page.
Devices (Pro)
Step 6 Devices limits the rule to Desktop, Phone or both. Nothing ticked means every device. Leave it alone unless you really need it:
- the server can only tell a phone from a desktop, not the exact screen size. Tablets count as phones, except recent iPads, which introduce themselves as a Mac and count as desktop;
- a page cache (a plugin or hosting feature that stores ready-made copies of pages) can serve the wrong version.
For layout choices by screen size, use per-block visibility instead.
The order of rules matters
The first rule from the top that covers a page decides. Put specific rules above general ones. Example:
- Price lists, resellers only: covers page 42, visible to the role Reseller.
- Whole catalogue, account required: covers the Products type, visible to anyone with an account.
A reseller opening page 42 matches rule 1 and gets in. A logged in customer opening page 42 also matches rule 1, does not have the role, and is stopped: rule 2 never gets a say. Swap the two rules and the exception disappears.
The rules list
In Content Gate > Rules each row shows Order, Rule, Who can see it, What it covers, Everyone else gets and State.
- Use the up and down arrows in the Order column to move a rule.
- Click the On / Off button in State to switch a rule on or off without deleting it.
- Hover a rule name to see Edit and Delete. Delete asks you to confirm first (Delete this rule? This cannot be undone.).
- In the free version, switched-on rules after the first 2 are greyed out and tagged over the free limit. They are saved but not applied.
Write to us and tell us which plugin, what you tried and what you see. We answer from Italy, usually within one working day.