How to Restrict Access to WordPress Pages and Posts by User Roles - ProfilePress

How to Restrict Access to WordPress Content by User Roles

You might want to restrict certain areas of your WordPress membership site to a specific audience and prevent the rest of the users or visitors from accessing it.

ProfilePress is the best WordPress membership plugin that’s specifically designed to help you restrict content in WordPress including posts, pages, custom post types (such as WooCommerce product pages), categories, tags, and taxonomies archive pages.

Before we walk you through the process of restricting content on your WordPress site, let us take a quick look at some of the common reasons site owners restrict access to their content.

Reasons for Restricting WordPress Content

One of the common reasons is site owners wanting to create a membership site. A membership site works on a model where a niche expert sells membership to visitors to let them access premium content that they don’t allow the other visitors to access.

There’s still a lot of free content to attract organic traffic from search engines, but then the visitors are encouraged to purchase a premium membership plan to access some of their best content.

If you want to create a membership site, ProfilePress is going to be the only plugin you need. You can simply restrict the content you want, and then redirect the visitors landing on the restricted content to your membership pricing page where they can purchase a membership plan.

Some of the other common reasons for restricting content include:

  • Promoting user registrations by offering them access to premium content on registration
  • Allow course creators to restrict their course content
  • Allowing editors or internal members to access private information on the site or restrict posts that need further work

User Profile Management

While ProfilePress lets you restrict content and manage user roles easily, it offers much more than that. And you do need other features too if you’re running a membership site or selling premium content access on your site.

After all, if you’re selling premium access, then you need to have a way for users to register and log in, too. You can easily create and manage registration and login pages. The article talks about creating these pages for LearnDash users but the process for membership site owners is going to be the same as well.

Similarly, once you have a large number of users, you need to have many different user roles that you can assign to them in order to restrict content to specific categories accordingly. You can easily do this with ProfilePress as well.

ProfilePress works on WooCommerce sites too, allowing you to create and manage “customer” user roles and restricting access to certain pages or posts. Similarly, you may have some exclusive products on your WooCommerce site that you may want to only offer to registered users or members first. ProfilePress allows you to restrict these product pages too while letting specific user roles access them.

There are many other great add-ons that add much more to the overall functionality of ProfilePress.

How to Restrict Content in WordPress

ProfilePress not only allows you to create awesome membership sites with no technical knowledge at all, but it also makes sure it takes you just a few clicks to do so. The ease of use is incredible.

You need to install and activate ProfilePress on your WordPress site. You can do so by clicking on the Add New option under the Plugins option and searching for ProfilePress. Click on the Install button and then the Activate button.

However, if you don’t have user registrations enabled on your site, you need to first do so in the General menu under the Settings option.

After clicking this checkbox, click on the Save Changes button at the end.

Then hover your mouse on the ProfilePress option and click on Content Protection. Click on the Add a Protection Rule button as you can see in the image below.

Now, this is where you can set up restrictions on any of the posts and pages you want, while also being able to manage the other restriction conditions as well.

Let us walk you through the few steps involved below.

You can start by selecting the condition for the restriction above. You can choose posts, pages, categories, tags, and even formats to restrict.

Similarly, you can choose whether to restrict all posts and pages or select ones. You also have other custom options such as restricting only the posts with categories.

We have decided to restrict one particular post on our site here. So, we clicked on the “Selected Posts” option under this dropdown menu.

We now have a list of all our posts pop up on the right, letting us select the ones we want to restrict. We just went with the first post on that list.

Now you need to choose the user roles that can access this particular post. You will find three options under that dropdown menu: Everyone, Logged in users, and Logged out users.

Most site owners would want to choose the Logged in users for obvious reasons. You will then just have some settings to take care of.

A lot of what you see is self-explanatory. First, you select the user roles you want to give access to.

Then you need to choose whether you want to show the restricted users an “access restricted” message or redirect them to some other page. If you have a pricing page that lets these users buy a membership plan, then you would want to redirect them to that page.

If not, then you further have the option to use the default “access restriction” message or make your own custom message telling the users that their access to that content is restricted.

But wait, there’s more! In addition to all these amazing features, you can also choose under the last dropdown menu whether you want to show your users the post excerpt as a teaser.

You can talk about the benefits the entire post content would offer in the excerpt, which would encourage the users to register and become a member to be able to access the entire post content.

However, if you want to fully restrict the content there, you can just choose the message to be shown and you’re good to go. Just click on the Save Rule button at the top-right and that’s going to be it.

This is how it’s going to look to your users who don’t have access to it. Please note that we have just used the default “access restricted” message here. You can make your own custom message too.

To restrict post and page content by user roles, we provide a shortcode to restrict content by user roles, usernames, and user IDs.

In Conclusion

You can do a lot more with ProfilePress than just restricting content. And the icing on the cake is that it doesn’t even slow down your site at all, since it’s a lightweight plugin with a super clean code but packed full of functionality.