Easily Restrict Content based on User Role with Profile Builder

Looking for an easy way to restrict content based on user role? If you run a community site on top of WordPress which allows user registration, you probably need a simple way to control which users can access certain pages.

In this tutorial, we’ll show you how to easily restrict access to certain WordPress pages by user role using Profile Builder.

You’ll have everything set-up and ready by following the 3 easy steps below:

Enable Content Restriction feature in Profile Builder

To ensure you get access to the Content Restriction feature within Profile Builder you’ll need version 2.6.9 or higher. Next, go to your WordPress Dashboard, download & install Profile Builder or if you’re using an older version, update the plugin to the latest version.

Then, under Profile Builder menu tab, navigate to General Settings and make sure you enable Content Restriction.

Set up Custom Restriction Messages

After activating the restrict content feature, you’ll notice a new submenu item appearing under Profile Builder tab, named Content Restriction.

From here you’ll be able to setup the type of restriction, as well as customize the default restriction messages users will see if they don’t have access to certain content.

You can also choose to display a short preview of the restricted content.

Based on these settings, if a non-logged-in user wants to access the restricted content, he will get a short preview containing the first 20 words or any number set in the settings, similar to the one below.

Restricting a Page, Post or Custom Post Type based on User Role

After setting up the restriction messages, in your WP admin panel simply navigate to each post, page or custom post type you want to restrict. Below the content editor you’ll notice a section called “Profile Builder Content Restriction“.

From here you can set up the type of restriction, select which user roles will have access to the content, as well as add custom restriction messages if required.

In the example below, the post content will be available for all our logged in users that have the user role of “Administrator” or “Author” attributed.

Furthermore, if we want to customize the restriction message for this specific post, we can type in something different than the default ones.

Also, if you want to send your users to another page, you can enable the redirect feature. Inside our post, we will redirect all of the users that don’t have the following roles assigned: Editor, Subscriber, SEO Manager or SEO Editor.

Note: You can replicate the same steps for restricting content based on user role for any other page, post or custom post type on your website.


Restricting Content based on User Role is pretty straight forward using Profile Builder.

You can use it in multiple scenarios, from providing members only content, to restricting access to personal or confidential data, or simply setting a WooCommerce store available to members only.

In case you need to create custom user roles Profile Builder comes with a built in Role Editor that can help you with that.

Are you currently restricting access to parts of your website? Let us know your ideas and methods in doing so in the comments section below.

Subscribe to get early access

to new plugins, discounts and brief updates about what's new with Cozmoslabs!

10 thoughts on “Easily Restrict Content based on User Role with Profile Builder

  1. your content restriction is super feature.
    I have one Problem. Sometimes we must hidden the complete post. Why that? Sometimes the headline tells too much. your content restriction needs this feature, then it is perfect.

  2. I have set all this correctly, but when given a direct URL, a logged out user can access content from the media library. How can i correct this?

    1. Hello,

      Profile Builder is not able to protect direct links that point to content from your Media Gallery.


      1. I have an option to protect options in the media library; what does that do, if not protect from accessing the image?

        1. It protects the WordPress Attachment Page link. This points to a WordPress page with the file.

  3. Hello,

    The content restriction does not work for me. I installed the plugin and restricted the content of one post to logged in users by checking the boxes in the restrict content section of this post. When I log out I can still view this post.

    Is there any settings I did not consider?

  4. We have done this with the Hobbyist version, but the registration form doesn’t seem to be adding the users. There is no email confirmation when that option is selected, and the users don’t appear in the admin panel to approve. Any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.