There are many reasons why some want to restrict page access to certain users. If you are looking on How to restrict page access to certain users in WordPress, then continue reading this post to know how to do this. Different people will have different reasons, but mostly, people create premium content and don’t want to give that content for free and wanted to sell them online using their website. This premium content can only be accessed by people who paid for their premium subscription. If you are looking to offer that kind of feature in your website, then this is the right place to see on how to do it.
For example, if you happen to see the website lynda.com, it offers video tutorials on various topics like PHP, MySql etc. Since, they are putting so much work in producing those videos, they don’t want to give those videos for free instead they created a subscription service and people who have subscribed to that service can only access their video tutorials. Even if you try to access their videos, then you will get a subscription message on the screen like the below.
You can create the same kind of functionality in your website with the help of some amazing WordPress plugins. You can customize your website to whatever you’ve needed with WordPress plugins now a days.
To restrict page access to certain users in WordPress, you need to use the plugin called Restrict Content
Now, open your WordPress admin panel, and go to Plugins and search for Restrict Content
Now, click on Install Plugin and then Activate the plugin.
Once the plugin is activated, you can see its options in Settings > Restrict Content
Now, if you click on Restrict Content Settings, here is how it appears in your admin panel.
Now, enter the restricted message to be shown to users who are restricted from accessing your premium content. You can also display messages to all group of users. If you want to restrict only certain group users, then enter the message to them.
After you have installed the restrict content plugin and configured its settings. Now, create a new page or edit the already existing page which you want to restrict.
In the bottom of the page editor, you can find the Restrict Content Settings as shown below.
You can now set the restrictions to the user groups you want to restrict. In my case, i am selecting Contributor group who can access the content. Once you have published your page with restrictions.
Once you have successfully published your content with restrictions, its time to check whether the restriction really applies or not. For this, try to create a test user account in your admin panel by navigating to Wp-Admin panel > Users > Add new
Before creating the user group, make sure, the user group is selected in the restricted group by default. In my case, i have choose to allow Contributor group and the default user group will be subscriber who has no access to my premium content.
Once, the user is created, now try to login with that new user account and try to access the restricted page you have just created. You should get the restricted message.
In my case this is what i’ve got.
You can also restrict a piece of content in your page by using a shortcode.
Use the following short code to restrict a piece of content
You need premium subscription to access this content
By default, WordPress restricts registering of new user accounts within your website. If this is the case, please continue reading on how to allow new registrations in your website.
To allow registrations, go to your WordPress admin panel > Settings > Check Anyone can Register
Choose the default user’s role for the registered people, and select the appropriate restrictions when creating your restricted content pages. Before going live, please double check all your settings and test your settings with a test user.
If you find this article to be helpful, please leave your comments below.