Show/hide content to users with specific capability

Restrict For Elementor

Support Request

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

Submit a Support Request

As mentioned in our documentation about restricting access to users with specific user roles here, user roles are quite powerful WordPress feature and can be used in many different ways including content restriction using our Restrict for Elementor plugin of course. Now, what you might not know is that each user role in WordPress is consisted of many different user capabilities. Each of these capabilities are allowing little something for users to access or do. For example, some of the capabilities are edit_posts, edit_pages, delete_posts, delete_pages, etc. To find out more about available user capabilities, you can find all of it in WordPress’ documentation here. However, it is not uncommon that some plugins are using some custom capabilities that can be used to grant access to custom user roles to certain areas of plugin. So, if you would like to find out which capabilities the existing user roles have on your website, you can install User Role Editor plugin which will clearly show you all the capabilities for all the user roles you have.

As you can see from this, user capabilities are quite powerful feature as they allow you to granularly control what each user can do on your website. Also, certain capabilities are shared across multiple user roles. For example, edit_posts is the capability that is available for Contributor, Author, Editor and Administrator user role.

Knowing all this, it is quite easy to conclude why we have included this as restriction criteria in Restrict for Elementor. So, when you add a section, column or widget with Elementor page builder, in the Restrict area of the Content tab, you can select Users with specific capability which will then reveal another field below where you will be able to enter capability that you want to use as criteria.

For example, let’s say that you want to allow certain section, column or widget to be accessible to all the registered users on your website except for the users with Subscriber user role. Of course, you can achieve this by selecting Users with specific roles and then select all the user roles except for Subscriber and it would work. However, with capabilities, you can simply enter edit_posts and you are done given that this capability is found in all of WordPress’ default user roles except for the Subscriber.

Another example would be that you have some custom user roles on your website all of which use some custom capability – let’s call it, for example view_restricted_content. By selecting this capability as criteria, you can show or hide the section, column or widget for all the users that have that capability.

Additionally, if you want, you can display alternative content to users that do not fulfill required criteria. More about this feature can be found here.