Skip to content

Roles and Capabilities

Shea Bunge edited this page Sep 28, 2013 · 3 revisions

Code Snippets uses custom capabilities to restrict or allow access to the admin pages.

Capabilities

Prior to version 1.9 there were three capabilities:

  • manage_snippets
  • install_snippets
  • edit_snippets

As well as their counterparts for the network admin:

  • manage_network_snippets
  • install_network_snippets
  • edit_network_snippets

In version 1.9 these were simplified into two: manage_network_snippets for all snippet operations in the network admin, and manage_snippets for all other snippet operations.

Restrict snippet operations to Super Admins only

If you choose you can restrict all site-wide snippet operations to Super Admins on a multisite network. This includes hiding snippet administration menus for regular site administrators. To do so, log in to the Network Admin (/wp-admin/network) and click on the Settings Menu scroll down to this option:

The 'Enable Administration Menus' setting under the 'Menu Settings' group

Unchecking the Snippets box will restrict snippet operations to Super Admins. Checking the box will allow site administrators to perform snippet operations

Filter Hooks

code_snippets_role (string)

The role to assign snippet operations to. Default: administrator

code_snippets_cap (string)

The capability to use for snippet operations. Default: manage_snippets

code_snippets_network_cap (string)

The capability to use for network-wide snippet operations. Default: manage_network_snippets