Documentation

Guides to help you get started

Including / excluding post types for content restriction

Support Request

If you need help with restrict, submit a support request, and we will get back to you shortly.

Submit a Support Request
Enabling custom post type for content restriction

It might happen that certain post type that you have on your website does not have an option for the content restriction. If that occurs, you can enable content restriction for that post type by using a simple snippet displayed below. You can add this snippet to your theme’s functions.php file or you can install plugins such as this one and add this snippet to it.


function add_specific_post_type($post_types){
$post_types[] = 'my_custom_post_type';
return $post_types;
}

add_filter('rsc_allowed_post_types', 'add_specific_post_type', 10, 1);

Of course, instead of my_custom_post_type (on the line 2 of the snippet) you should use the post for which you want to enable content restriction.

 

Disabling restriction for the specific custom post type

By the same account, you can also remove the content restriction for certain post type. To do this, you should use the following snippet:


function remove_specific_post_type($post_types){
$post_types[] = 'my_custom_post_type';
return $post_types;
}

add_filter('rsc_skip_post_types', 'remove_specific_post_type', 10, 1);

Again, instead of my_custom_post_type (on the line 2 of the snippet) you should use the post for which you want to disable content restriction.

 

In both cases, the action of adding new post type or removing the one that you don’t want to will also affect the Post Types area of the Restrict plugin: the enabled post types will appear in the Post Types area which will then allow you to select the default behavior for content restriction for that post type while the disabled post types will be removed from the Post types area.

 

Of course, if you don’t feel comfortable doing this yourself or simply don’t want to be bothered with this, you can always contact our support team and we’ll do this for you.

 

Note: the content of some custom post types that some theme or plugin installed on your website is using, might not be affected by Restrict plugin even if you enable content restriction here.