There would be times in the management of your website when you would want certain posts or a set of pages to be available only to a certain audience and not to the general public. At certain times, you might want the post not even visible to the public unless someone knows what he is looking for. In this post we would describe ways to achieve password protected areas in WordPress.
There are many ways to achieve this. You can use the inbuilt feature in WordPress, which can assign passwords to certain specific posts, or you could use a plugin to manage certain areas or sets of pages. Let us look into the former process first.
1. Using the WordPress publishing tool to set a password (without user registration):
In WordPress, when you create a post, you are given the option of ‘Visibility’ on the right column.
Select ‘Password Protected’ under visibility and put in a password for viewers to enter before viewing the post. Click ‘Publish’ to publish the post.
On entering the password, you are able to view the post.
Note that this applies to pages too. You can set passwords for pages using the same process.
This way of adding passwords to pages and posts has an advantage. The user doesn’t need to be registered and logged in to view posts. Just putting in the password is sufficient to view the content.
This process, however, is not efficient when you are using it for many posts or pages. Suppose you have a bunch of such password protected pages. Every time a legitimate user wants to open these pages, a password has to be provided for every single page. That can make the process annoying, although it serves the purpose of security well. To solve this problem, we arrive at our next step, the use of plugins.
2. Role Scoper Plugin:
The first plugin that we would see is Role Scoper. Head over to the plugin’s page on the WordPress site to download and follow the instructions for installation. Alternaltely, you can search for ‘Role Scoper’ in Plugins > Add New in the left column of wp-admin to search for it and install it from within the WordPress site.
Role Scoper gives you a CMS like permissions for reading and editing posts. You can use the WordPress roles, or even create User Groups. You can basically assign roles and restrictions to certain posts, pages or categories.
On activation of the plugin, you would see a new menu item appears on the left column of wp-admin. Also, you would have additional options on the create/edit post in posts.
If a user without being in the list given above opens the post, WordPres would show a ‘Page Not Found’. Note that you would not be redirected to a login page in case you are trying to visit a restricted page.
However, if you are already logged in and open the page, you would be able to view it normally.
It is as if the post vanished from public view, and that is how it should be!
For creating such restrictions for a bunch of posts (with the same category), you should go to Restrictions > Categories and edit the reading and editing restrictions for all categories of posts. You can either manage settings for all categories or for certain categories.
You can do the same with posts or pages too by going to Restrictions > Posts or Restrictions > Pages, and applying restrictions to all posts/pages or individually.
This plugin has been in development with the last update being less than three months back and you would be wise to use it.
3. User Access Manager Plugin:
The next plugin that we would inspect is the User Access Manager plugin. Head over to the plugin’s page on the WordPress site to download and follow the instructions for installation. Alternaltely, you can search for ‘User Access Manager’ in Plugins > Add New in the left column of wp-admin to search for it and install it from within the WordPress site.
This plugin, like the previous one, helps you manage access to your posts, pages and files. You just need to create a user group, put registered members in it and set up rights for the group. This helps you in creating restricted areas within your site.
Upon activating the plugin, you would find that a new item has been added to the left column of wp-admin, UAM, short for the name of the plugin.
Click on UAM > Manage User Groups and create a user group. Note that user groups are essential for this plugin and you wouldn’t be able to use the functions before defining the user groups. You can even select an IP range for a user group to add an extra level of security.
After creating the user group, you can manage roles for the user group.
On adding a post or a page, you can specify which user groups can have access to it.
<img class="aligncenter" alt="" src="https://lh5.googleusercontent.com%2