WordPress – How to Restrict Access to Posts Based on the User Company

In this tutorial, we show you how to restrict access to posts based on the user company. You’ll be able to restrict access for users who use a specific email address, and that way you’ll restrict access to all users from a company.

For example, you may want to restrict access to posts to all users who have a @company account. In that case, you’d have to normally program that conditional restriction from scratch, but you need a lot of programming knowledge. You can also hire a professional programmer, but he would take his time, charge you with a lot of money, and that would be the only conditional restriction you’d be able to apply to your posts.

However, with the WordPress Conditional Post Restrictions plugin, you can easily apply conditional restrictions to:

  • Posts
  • Pages
  • Courses
  • Events
  • Products
  • Donations
  • Recipes
  • Forums
  • And any other custom post type.

Once you install and activate the plugin, follow the steps in this guide to restrict access to posts based on the user job company. We’ll show you how to restrict access to all posts, a specific post category, and individual posts.

1- Restrict access to all WordPress posts based on the user company

In this section, we show you how you can easily restrict access to all WordPress posts based on the user company.

We’ll use the email address as the parameter to know which company users come from, so we need to follow these steps:

  • Open the global conditions of WordPress Conditional Post Restrictions by going to Settings > Post Restrictions.
  • Tick the Enable restrictions checkbox.
  • Click Add conditions to create a new condition.

wordpress restrict access to posts based on user company

Now you need to select the following values to restrict access to your WordPress posts based on the user company:

  • Add new restrictions: Enter the restriction title.
  • Select post types: Posts
  • What happens when the restrictions are met: Restrict access
  • Condition 1: User email | Contains | @company
  • Publish the condition.

wordpress restrict access to posts based on user company

With these values, you’ll ban all users from a specific company from reading your WordPress posts. You’ll do it using their email company as the restriction parameter.

If you want to Allow access instead of restricting it, you just need to select that value in What happens when the restrictions are met.

2- Restrict access to a category of WordPress posts based on the user company

We´ll now show you how to restrict access to an entire category of WordPress posts based on the user company. The WordPress Conditional Post Restrictions plugin allows you to apply restrictions to post categories instead of restricting access to all your posts.

Again, we’ll use the email address as the restriction parameter. This is what you need to do:

  1. Go to Posts > Categories in wp-admin.
  2. Open a specific category to edit it.
  3. Scroll down to the Posts and Category Restrictions section.

Once you’re in the Posts and Category Restrictions section of the category you’re editing, select the following values to restrict access to this category based on company/job:

  • Enable the conditional restrictions: Yes
  • Apply restrictions to: Category and posts
  • What happens when the conditions are met: Restrict access
  • Condition 1: User email | Contains | @company
  • Update the category

wordpress restrict access to posts based on user company

This is how you can restrict access to an entire category of WordPress posts based on the user company. All users whose email contains the selected email company will be banned from your WordPress posts.

If you want to Allow access instead of restricting it, you just need to select that value in What happens when the restrictions are met.

3- Restrict access to individual WordPress posts based on the user company

If you don’t want to restrict access to all posts nor entire post categories, you can restrict access to individual posts based on the user company.

To restrict access to individual posts you need to follow these simple steps:

  1. Go to Posts > All Posts in wp-admin.
  2. Open the post you want to restrict.
  3. Scroll down to the Restriction Rules section in the post editor.

Once you’re in the Restriction Rules section, you need to select the following values:

  • Enable content restrictions: Yes
  • What happens when the conditions are met: Restrict access
  • Condition 1: User email | Contains | @company
  • Update the post

wordpress restrict access to posts based on user company

This is how you can simply restrict access to individual WordPress posts based on the user job company, using the email address as a restriction parameter.

If you want to Allow access instead of restricting it, you just need to select that value in What happens when the restrictions are met.

What happens when users try to read restricted posts?

You can decide what happens when users try to read restricted posts. You need to edit the WordPress Conditional Post Restrictions plugin’s global settings.

Go to Settings > Post Restrictions.

You can add redirect links or show error messages to your users.

It’s really easy and fast!

You don’t need to program anything nor hire a professional programmer. You can easily restrict WordPress posts based on the user company. The WordPress Conditional Post Restrictions plugin allows you to easily apply conditional restrictions to your posts, pages, products, downloads, events, courses, etc.

Close Menu