How to Restrict WordPress Page Access by User Roles

You spend hours writing content, creating images, and getting everything ready for visitors. So why would you want to restrict access to certain users?

There are good reasons for this. You might need to protect online learning materials that should only be available to your students. Or you could be hosting confidential data that needs protection from public access.

WordPress has built-in features for protecting content, from password-locked pages to admin-only visibility. However, plugins give you much better control when you want to grant specific user roles access to private content.

This article explains WordPress user permissions and shows you how to restrict access to certain pages easily.

WordPress user roles and permissions

User roles define what certain users can and cannot do on your website. WordPress offers 5 default roles – admin, editor, author, contributor, and subscriber.

  • Admin is the most powerful user role. They can manage the entire website, including adding or deleting content, plugins, themes, and users. They can also change information about existing users, such as passwords.
  • Editors can manage everything related to your WordPress content. These users have full control over their own pages and posts, as well as those created by other users. They can moderate, edit, and delete comments left on your website.
  • Authors focus exclusively on writing, editing, and publishing their own pages and posts. Content added by others isn’t visible to them. Administrators allow this role to assign categories to posts but prevent them from creating new categories.
  • Contributors can log in to your website, add and edit new posts, but they cannot publish them. However, they can add new tags without administrator permission.
  • Subscribers have the lowest default user role. They can log in to your WordPress website and update their own profiles. Writing and publishing posts or previewing comments isn’t possible for them.

The default user roles work for most websites. If you want to add new customized roles and make selected functions available to your users, you’ll need a user role editor plugin.

Consider which roles you want to add based on your website type. An e-commerce website needs “Customer” and “Shop Manager” roles, while blogs might need “SEO Manager” and “SEO Editor” roles for the publishing process.

How to restrict access to WordPress pages through user roles

Sometimes you want to set up restricted content for members without creating an entire membership site. The membership site process can take significant time and effort.

The free Password Protect WordPress plugin protects your content with passwords. You can also assign roles to each password. This means only logged-in users with certain roles can use the password and view the protected content. Everyone else receives an error message when they try to access the content.

To use the plugin, follow these steps:

Go to Plugins and click Add New in your WordPress dashboard.

Enter “password protect page” in the keyword field, then install and activate the plugin.

Edit the desired page or post in the Pages and Posts sections.

Activate the “Password Protect WordPress” option in the top right corner of the page, then select a user role and enter your password.

Finally, submit the password and update your content. You can create multiple passwords for a single post. Each password can have its own user role.

Grant direct access for roles on the whitelist

Regular users such as administrators or editors often need access to protected content. Having them enter passwords every time they view protected pages wastes time. This is where the “whitelist roles” function helps.

ppwp-whitelisted-roles

You can decide which user role should open private content without entering passwords. Click on “Select custom roles” if you want other or multiple user roles to see the secure pages and posts.

This method requires updating to the Pro version of the plugin. Here’s how to get the Pro version of PPWP and set the whitelist role to Subscribers:

Download PPWP Pro plugin. In your WordPress admin area, go to Add new under Plugins.

Click on the Upload plugin button and select the plugin zip file you downloaded.

Activate the plugin and access the page with the plugin settings.

Select “Logged in users” in the “Whitelisted roles” dropdown list

Conclusion

There are various reasons to restrict access to WordPress pages and content based on user roles. Premium customers can view private product pages, while shop managers can add or edit product pages and manage categories and comments.

The WordPress plugin Password Protect Lite and its Pro version provide an excellent solution for restricting user access. Instead of setting up an entire membership site, you can lock content with passwords and assign roles to them. Users only need to enter the password to view the content.

Install the PPWP Pro plugin and you’ll have full control over your WordPress site access restriction through user roles.