Wordpress services, tutorials and news

How to restrict users access to certain posts in WordPress

In this tutorial I will show you how easy is to create posts that are restricted to the general public and only available for users belonging to a specific category. To do this, we need 3 things:

  • a way to mark a post as being available to a specific category of users
  • a way to create the special users category
  • restrict the content view

The easiest way to do this is by using the Members plugin by Justin Tadlock.

Installing the Members plugin

To install the Members plugin:

  • download the Members plugin from here.
  • upload the Members plugin to the /wp-content/plugins/ directory
  • Go to the plugins menu:

Add new WordPress Plugin

  • Activate the Members plugin

Enable Members plugin

Using the Members plugin

The Members plugin is relatively simple to use. First thing is to activate the plugin components that you are actually going to use (the plugin comes with more capabilities and you can select which ones you want to use). Go to the settings menu and click on the “Members components” Members components Enable the features you are planning to use. Each feature is described, if you are not sure which ones you need, enable them all: Select component As soon as you have enabled some features, you need to assign the capabilities to an existent role. Go to the Users menu and click on the “Roles” tab. Roles Assuming you want to give the new capabilities to the administrator role, click on the “administrator” link Edit roles Add the new capabilities to the administrator role. For example: “edit roles”, “delete roles”, “create_roles”, and most importantly “restrict content” Capabilities With the “restrict content” capability assigned, you can already mark posts as being restricted to certain user types.

Creating a new user role

If you don’t want to make the content available to one of the standard WordPress roles, you can create a new role, then assign the right to view content to that role in the post editing page. To create a new user role, go to the Users tab and select the “New Role” page. New role In the new window, create a new role and assign a label to the new role: Role label  

Creating restricted content

Creating restricted content is very easy. Go to edit/add new post and below the editor you will see now the list of user roles where you can select which roles have the right to view the content. Restricting content Here is what a regular user will see in the front-end: View restricted content

Testing that the special users are able to see the restricted content

Right now, you know that the content is not available to regular users, but is it available to the users that are supposed to view the content? To check this, let’s create a new user and assign it the special role you have created earlier. Add new user Logout and login as the special user: Login Go to the front-end, and voila! The restricted content is available for you! View Content  

Related Posts


  1. I tried this plugin. It fails when I use the wp_list_pages command. The restricted page is still there.

  2. I was wondering if this plugin can restrict Menu Items as well.
    I have a site that will have 2-3 different user categories, that need to see only certain information and everything else needs to be hidden.

    Is it possible to hide menu items? Or set separate menus for each user type that logs in using this plugin?


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.

Wordpress templates