Discover in this tutorial how to give the ability to view Gravity Forms posts to a custom WordPress user role via code, without plugins.
By default, WordPress has 5 user roles:
- Subscriber >
( 'subscriber' )
- Contributor >
( 'contributor' )
- Author >
( 'author' )
- Editor >
( 'editor' )
- Administrator >
( 'administrator' )
In addition to those, some plugins can add new roles. For example, WooCommerce creates two more:
- Store manager
In fact, in a previous tutorial you learned how to create a new user role with the capabilities you want.
In this case, I’m going to tell you how you can extend the capabilities of the user role of your choice so that it can access Gravity Forms form entries. Something very practical, for example, if you want to give access to a virtual assistant.
Let’s see how to do it:
Snippet to allow a user role to read Gravity Forms entries
Add the following code at the end of functions.php or in your functionality plugin:
With this snippet you first get the role
'asistant' and then add the ability to view entries with the
This is just an example, where you allow the person(s) who have the
asistant role to have access to review Gravity Forms entries. But the idea is that you assign it to the user role that interests you.
By the way, the new capability is saved in the database so once you have refreshed the page, which will make the code to run, you can delete the snippet.
Now you know how to allow a WordPress user role to view submissions received on Gravity Forms, with a simple code snippet.
Any questions? I read you in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉