WordPress – How to Restrict Posts by Email Address

In this tutorial, we show you how to restrict posts by email address in WordPress.

You can easily publish posts and restrict them by email address so only your company members have access to them. You can also prevent access to your WordPress posts from specific email addresses.

Normally, you’d have to program that conditional restriction from scratch. But here we show you how restrict posts by user email address using the WordPress Conditional Post Restrictions plugin. With this plugin, you can create conditional restrictions for your:

  • Posts
  • Pages
  • Courses
  • Events
  • Products
  • Downloads
  • Donations
  • Forums
  • And any other custom post types

Once you install the plugin, follow these simple steps to publish posts for specific email addresses:

1- How to restrict posts by email address globally

To restrict posts by user email address, you need to add a global restriction. For this, you need to open the plugin’s global settings:

  1. Go to Settings > Post Restrictions.
  2. Click Add Condition to create a global restriction.

Now you need to select these values to restrict all posts for users with a specific email address:

block posts by user email address wordpress

  • Enable content restrictions: Yes
  • What happens when the conditions are met: Restrict access or Allow Access
    • Restrict access means users won’t be granted access to your posts.
    • Allow Access means users will be granted exclusive access to your posts.
  • Condition 1: User email | = | user@email.com
    • If you want to restrict posts for several email addresses, click Add “Or” group to create another condition group.
  • Publish the condition.

With these simple values, your posts will be restricted for the users you selected.

2- How to restrict post category by user email address in WordPress

If you don’t want to restrict all posts by the user email address, you can restrict a post category. It’s really simple.

  1. Go to Posts > Categories in wp-admin.
  2. Open the category you’ll edit.

Once you open the category you’ll restrict for users with a specific email address, you need to select the following values:

block posts by user email address wordpress

  • Enable the conditional restrictions: Yes
  • Apply restrictions to: Category and posts
  • What happens when the conditions are met: Restrict access or Allow access
    • Restrict access means users won’t be granted access to your posts.
    • Allow access means users will be granted exclusive access to your posts.
  • Condition 1: User email | = | user@email.com
    • If you want to restrict posts for several email addresses, click Add “Or” group to create another condition group.
  • Save the changes.

With these values, you’ll have banned users with a specific email address from a post category.

What if users try to access restricted posts?

WordPress Conditional Post Restrictions allows you to select what happens if users try to access restricted posts. You just need to do the following:

Open the plugin’s global settings at Settings > Post Restrictions.

Once there, you’ll see these fields and options:

  • Enable restrictions: Tick/untick this checkbox to enable/disable the global conditions.
  • Don’t apply restrictions for these user roles: You’ll see a list of user roles for which the conditions won’t be applied. By default, we will not apply restrictions for administrators, editors, and any user with the capability edit_others_posts.
  • What happens when the post is restricted? You have several options to select what happens when the post is restricted:
    • Redirect to URL
    • Remove the content and show a message
    • Show fragment of the content and show message after fragment
  • What happens when a category is restricted? You have several options to select what happens when the post is restricted:
    • Show error 404
    • Show the normal page without posts
    • Show an error message
    • Redirect to another URL
    • Show the content of another page

Once you select the global settings, just save the changes.

Restricting posts by email address is really easy!

As you see, you don’t have to worry about using any PHP snippets to apply conditional restrictions to your WordPress posts.

You just need a few clicks and the restrictions will be set with WordPress Conditional Post Restrictions.

Close Menu