Restrict Posts/Pages/Custom Post Types
This feature allows you to restrict entire post/page/custom post type and redirect restricted users to a custom page with restriction message. You can restrict posts for guests, members and specific user roles.
Content of restricted posts/pages will be hidden from Category, Tag, Taxonomy, Archive, Author pages as well as RSS feeds. Simple restriction message will be displayed for restricted posts on these pages.
Let’s see how we can enable restrictions from post/page create or edit screens.
Using Restriction Settings
You can go to Posts -> Add New or Pages -> Add New to see the available restriction settings. Meta box with restriction settings will be displayed under the post/page editor as shown in the following screenshot.
These settings are also available for any Custom Post Type created from any third party plugin.
First, you have to select the Visibility of the post/page. By default, its visible to everyone viewing your site. You have 3 other options called Guests, Members, Selected User Roles.
- Guests – Allows you to make the post/page visible only to guest users who doesn’t have a user account.
- Members – Allows you to make the post/page visible only to members who have a user account and logged into the site.
- Selected User Roles – Allows you to make post/page visible only to the selected user roles
If you choose Selected User Roles option, you will get another setting called Allowed User Roles as shown in the following screenshot. You cam select the user roles allowed to view this post/page.
If someone is not allowed to access the post/page, they will be redirected to the URL specified for Post/Page Restriction Redirect URL setting as shown in the following screenshot.