Let’s learn how to restrict posts for WooCommerce customers.
You can restrict access to posts so WooCommerce customers don’t read them, or you can do the opposite: create posts for WooCommerce customers only.
This is something you can’t normally do without having to program that conditional restriction or hiring a professional programmer.
But here we’ll show you how to do it easily with the WordPress Conditional Post Restrictions plugin.
It allows you to apply conditional restrictions to your posts, pages, products, courses, events, downloads, recipes, forums, etc.
You can apply these and more restrictions easily:
- IP
- Post Viewed Count
- Referer
- URL
- User role
- User email
- User email company
- Days since user registration
- User enrolled in course
- User courses count
- Hour of the day
- Date
- Day of the week
- Day of the month
- Month of the Year
- Etc.
You can download the plugin here:
Download WordPress Conditional Post Restrictions Plugin - or - Read more
Once you install and activate the plugin, you need to follow these simple steps to restrict access to posts for WooCommerce customers.
1- How to restrict all posts to WooCommerce customers
You can completely ban WooCommerce customers from reading all your WordPress posts or you can allow access to your posts to WooCommerce customers. You just need to follow these simple steps:
- Go to Settings > Post Restrictions.
- Tick the Enable restrictions checkbox.
- Click Add conditions to create a new condition.
Once there, select the following values to restrict or allow access to all posts to WooCommerce customers:
- Add new restrictions: Enter the restriction title.
- Select post types: Posts
- What happens when the restrictions are met: Restrict access or allow access
- Condition 1: User role = Registered customer
- Click Add ‘Or’ group.
- Condition 1: User role = Guest customer
- Publish the condition.
Depending on whether you restrict or allow posts, customers will be banned or granted exclusive access to your WordPress posts.
2- How to restrict an entire category to WooCommerce customers
If you don’t want to restrict access to all your posts, you can restrict access to an entire category of posts to WooCommerce customers.
You can easily to it by following these simple steps:
- Go to Posts > Categories.
- Open the category you want to edit.
- Scroll down to the Posts and Category Restrictions section.
Now you need to select the following values to restrict or allow access to an entire category of posts to WooCommerce customers:
- Enable the conditional restrictions: Yes
- Apply restrictions to: Category and posts
- What happens when the conditions are met: Restrict access or Allow access
- Condition 1: User role | = | Registered customer
- Click Add ‘Or’ Group to add another condition group.
- Condition 1: User role | = | Guest customer
- Update the category
If you restricted access to this category, customers won’t be able to read the posts within this category. If you allowed access, only customers will be able to access this content.
3- How to restrict access to individual posts to WooCommerce customers
If you don’t want to restrict access to all posts nor restrict access to post categories, you can restrict access to individual posts to WooCommerce customers.
Just follow these simple steps:
- Go to Posts > All Posts in wp-admin.
- Open the post you want to restrict.
- 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 or Allow access
- Condition 1: User role | = | Registered customer
- Click Add ‘Or’ Group to add another condition group.
- Condition 1: User role | = | Guest customer
- Update the post to save the changes
These simple steps allow you to restrict or allow access to individual posts to WooCommerce customers. You need to repeat the same steps to restrict other posts.
4- What if a user tries to access restricted posts?
This is how you can select what happens when customers try to access restricted posts.
- Go to 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.
That was really simple!
It’s really simple to restrict access to posts to WooCommerce customers. You don’t have to program anything because WordPress Conditional Post Restrictions allows you to do it with a few clicks.
You can download the plugin here:
Download WordPress Conditional Post Restrictions Plugin - or - Read more