Normally you should be able to use the Members plugin to control access to global snippets. However, the plugin makes excessive use of WordPress’ REST API. So you also need to make sure, the REST-API calls can be made by users other then administrators. Here is how it works:
Capabilities to global snippets
As I wrote above, you can use the Members plugin to configure access to global snippets. However you also need to manage access to the REST API:
Capabilities for the REST API
Use the following filter to change access to the REST API:
wpbuddy/rich_snippets/rest/permission
Here is an example extension-plugin that you can use to change these permissions: Watch on Github.
- You can download it here.
- Then unzip and edit it with your favorite editor.
- Change line number 32 so that it fits your needs. Meaning, to change the
'manage_options'
string to something different. - Upload it to your WordPress wp-content/plugins/ directory.
- Log-in to your WordPress dashboard.
- Go to “Plugins” and activate the plugin named “snip – REST API Capability Changer”.
That’s it.