View Categories

How to Restrict Whole Site for Certain Users?

You can restrict access to your entire WordPress website using the User Registration & Membership plugin. This comprehensive guide covers both the free version method (available in v4.0+) and advanced Pro methods for complete site access control.

Prerequisites: 
✅ User Registration & Membership v4.0 or higher for basic method. 
✅ User Registration & Membership Pro for advanced method.
✅ Content Restriction Addon.

Install User Registration & Membership (If Not Installed) #

The Content Restriction add-on is available on the free version of the plugin, but to use the advanced Content Restriction features, ensure that the User Registration & Membership Pro is installed and activated. If not, purchase it from wpuserregistration.com and follow our guide on activating it with a license key.

Activate the Content Restriction Addon #

After installing and activating the plugin, follow the steps mentioned below:

  1. Navigate to User Registration & Membership > Addons in your WordPress dashboard.
  2. Search for the Content Restriction Addon and toggle to Activate.

Method 1: Basic Whole Site Restriction (Free) #

User Registration & Membership’s free version includes basic whole site restriction functionality through its global settings.

Configure Whole Site Restriction #

  1. Go to User Registration & Membership > Settings > Content Restriction.
Whole Site Restriction for Free
  1. Toggle Enable Whole Site Restriction to ON.
  2. Configure the following global settings:

Allow Access To Options

From here, you can select whom you want to give access to your site.

  • All Logged-In Users: Any registered user can access the site.
  • Specific Roles: Select specific WordPress roles (Admin, Editor, Subscriber, etc.)
  • Guest Users: Allow non-logged-in visitors (defeats the purpose of the restriction).
  • Memberships: Custom subscription tiers (if using membership features).
Access Control for Membership Site

Restricted Content Message:

Set a custom message to display to unauthorized users. You can include HTML formatting and smart tags to customize the message.

Click Save Changes to apply your whole site restriction settings.

Test for Configuration #

Let’s test the configuration on our site:

Common Use Case: Restrict site to non-registered users

  • Enable Whole Site Restriction: ON
  • Allow Access To: All Logged-In Users
  • Message: “Please log in to access this content. Register here if you don’t have an account.”

To test content restriction, open your website in incognito mode, and it should display the restriction message:

Content Restriction Example

Method 2: Advanced Whole Site Restriction Pro #

Once you have activated the Content Restriction addon on the premium plan of the User Registration & Membership plugin, you can add advanced content restriction rules. This rule will have the conditions for content restriction and action when the restricted users try to access the content.

Step 1: Adding a New Rule #

Navigate to User Registration & Membership > Content Rules. Next, click on the Add New button to add a new rule.

After clicking on Add New, you will see a window as shown below:

Give a name to the rule and choose whether you want to create an access rule or a restrict rule.

Access rules provide access as per the condition you set, and the restrict rules will restrict the content. Then, click on Continue.

Step 2: Define Advanced Content Rules for Content Restriction #

After you click the Continue button, you will be redirected to the Conditions & Logics tab. Here, you’ll see a Main Logic Group section.

Condition and Logics Tab for Content Rules

From this interface, you have the option to Add Fields where you can choose from various fields and set values for them.

Adding Fields

Click on the Add Field button to see a drop-down with a list of options where you can choose between various fields to set up a condition.

You can select those from the list that you feel are necessary.

Add Field Options for Content Rules

Let’s break down the available conditions under the Add Field button:

User Based
  • Roles: Users must have any one of the selected roles.
  • User Registered Date: Users must be registered within the selected date range.
  • Period After Registration: You can set the number of days during or after which the user can access the content.
  • User State: You can define whether the logged-in or logged-out users can access the content.
User Assets Based
  • Email Domain: Specify particular email domains so that users with the specified email domain can only view the restricted content. You can select multiple email domains, separating them with a comma. Like, gmail.com, hotmail.com, wpeverest.com, etc.
  • Minimum Public Post Count: The content visiting user must have a minimum specified number of public posts on your site as public.
Others
  • Capabilities: The content-visiting users must have all the listed capabilities to access the content.
  • User Registration Source: Users must be registered from defined sources to visit the content.
  • UR Form Fields: This field lets you choose the form field from any available User Registration forms. You can set a conditional logic so the restriction/access happens when the form field value matches the condition.
  • Payment Status: You can select the payment status among Pending, Completed, and Failed.

Logic Operators:

  • AND: All conditions must be met
  • OR: Any condition can be met
  • NOT: Conditions must NOT be met

So, select the field and set the logic operator for applying the restriction rule.

Add Field and Logical Operator for Content Rules

Next, click on Add Group, where you can add a sub-logic group inside, and you can again add different fields, use logical operators, and so on.

Step 3: Add Target Contents #

Click on the Target Contents tab and then click on the Add Fields button inside the Target Contents tab to specify which contents are restricted or allowed. You will see the following options:

  • Post Types
  • Taxonomy
  • Pick Posts
  • Pick Pages
  • Whole Site

If you’re creating a content restriction rule for your entire site, select Whole Site. Hence, users who satisfy the defined condition will be restricted from visiting your site.

However, if you add the Whole Site restriction, logged-out users will be blocked from accessing your login or registration form page.

Advanced Whole Site Restriction
To avoid this, either render the login form using a shortcode or select the "Show Message" option under the Action section. When using the "Show Message" option, you can include the login and registration form shortcodes within the message so that logged-out users can still log in or register on your site.

Step 4: Select Actions for Content Rule #

Let’s give access to the logged-out users to log in through the Action tab. From here, you can choose what happens when access is denied:

Access Control: Either choose access or restrict based on your settings.

For whole site restriction:

  • Use “Access” to allow only logged-in users, specific roles, or members.

Available Actions

  1. Show Message: Display a custom HTML message with media and form integration.
Choose Content Restriction Action as Message

You can modify the message using the editor and Smart Tags.

2. Redirect: Send users to a local page offered by the plugin.

Choose Content Restriction Action as Redirect to A Local Page

3. Redirect to Local Page: Send to a specific page on your site.

Choose Content Restriction Action as Redirect

4. Show UR Form: Display registration/login form offered by the plugin.

Choose Content Restriction Action as Show UR Form

5. Render Shortcode: Execute specific shortcode. While using the shortcode, you need to add the form id as shown in the image so that specific form will be displayed to the users.

Choose Content Restriction Action as Render Shortcut

Click on the Create Rule button to add the new rule.

Test Advanced Whole Site Restriction #

Similar to the above section where we tested for the whole site restriction for the free plugin, you can configure the settings following the advanced steps and test the configuration. Based on the action you selected, it should act accordingly:

Advanced Whole Site Restriction

In our testing site, we configured the whole site restriction, and the action we set up was to Render a Shortcode. In our shortcode, we had added our custom form for registration.

Powered by BetterDocs

Scroll to top