Code Snippets includes full support for WordPress multisite. When using this plugin on a WordPress multisite network, you have several options for how you want it to behave.
Using the plugin on individual sites
This is the option if you want to treat each site separately, and have Code Snippets behave in the same way as if each site had its own WordPress installation.
To use this option, don't Network Activate Code Snippets from the Network Admin. Instead, visit the Plugins menu on each site where you'd like to use Code Snippets and click 'Activate' to turn on the plugin for this site.
Using the plugin on all sites
If you want to use Code Snippets on every site on the network, you can do so by visiting the Plugins menu in Network Admin, and clicking 'Network Activate' in the Code Snippets row.
Running snippets across the entire network
If you have a set of code snippets that you want to run on each site in the network, you can achieve this by visiting the Snippets menu in the Network Admin. Please note that while this is compatible with either of the two options mentioned above, you need to at least have Code Snippets active on the primary site in the network to have this menu appear. Also, if you have decided to only enable Code Snippets on specific individual sites in your network, snippets which are Network Activated in this way will only run on those sites. Snippets will not run on any site that does not have Code Snippets active.
To create a network snippet, visit the Network Admin dashboard and navigate to the Snippets menu. Create a new snippet, or choose an choose an existing one from the list. On the Edit Snippet page, ensure that the Allow this snippet to be activated on individual sites on the network box is unchecked. Click the 'Save Changes and Activate' button to have this snippet run on all network sites where the Code Snippets plugin is active.
If you have an existing snippet that has already been created and has the Allow this snippet to be activated on individual sites on the network box unchecked, you can also network activate or network deactivate it it through the toggle on the main Snippets menu.
Running snippets on specific individual sites on the network
If you have a snippet that you would like shared between multiple sites on the network, while still being able to choose which specific sites it is enabled on, you can do so with network shared snippets.
To create a network shared snippet, navigate to the Snippets menu in the Network Admin, and either create a new snippet or edit an existing snippet. On the edit screen ensure that the Allow this snippet to be activated on individual sites on the network box is checked, and the snippet is saved.
Next, navigate to a subsite where you would like this snippet active. You should see your network shared snippet in the snippets list along with those created on the subsite. You can activate and deactivate these snippets like normal, but in order to edit or delete them you will need to be logged-in as a Super Admin and access them through the Snippets menu in the Network Admin.
Restricting Snippets menu access on subsites
By default, Snippets menus can be accessed by site administrators – users on subsites who have administrator access for that site. Only Super Admins can access the Network Admin Snippets menu.
If you would like to change this behaviour so that only Super Admins can access any Snippets menu, you can do so from the Network Settings menu, accessible by visiting the Network Admin and navigating to the Settings menu. Once on this page, scroll down to the 'Menu Settings' section to find these options:
Unchecking the 'Snippets' box will restrict access to all Snippets menus to Network Administrators only.
Unchecking the 'Snippets » Settings' box will remove the Snippets » Settings menu on subsites, and add a new Settings submenu to the Snippets menu in the Network Admin. Settings configured here will be applied to all sites on the network.