How can I control access to global snippets?

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.

  1. You can download it here.
  2. Then unzip and edit it with your favorite editor.
  3. Change line number 32 so that it fits your needs. Meaning, to change the 'manage_options' string to something different.
  4. Upload it to your WordPress wp-content/plugins/ directory.
  5. Log-in to your WordPress dashboard.
  6. Go to “Plugins” and activate the plugin named “snip – REST API Capability Changer”.

That’s it.