What is GravityOps Code Snippet Manager? #
GravityOps Code Snippet Manager (GOCSM) is a WordPress plugin for managing PHP, JavaScript, CSS, and HTML code snippets. It provides the same activate/deactivate workflow you expect from tools like Code Snippets, plus two capabilities those tools do not offer:
- GitHub-sourced collections — Keep a snippet library in a GitHub repository, public or private. GOCSM checks it for updates and lets you review and apply changes without losing your customizations.
- Configuration preservation — Each snippet can declare configurable values (form IDs, URLs, messages) in a config block. Those values are stored separately from the snippet code, so updating the snippet never overwrites your settings.
Plans #
GOCSM has three paid plans. Every plan uses the same plugin, and higher plans include everything in the plans below them.
- Pro — the complete snippet manager: PHP, JavaScript, CSS and HTML snippets, the configuration panel, full revision history with side-by-side comparison, page targeting, folders and tags, the HTML Snippet block, the security scan, load-time tracking, crash protection and safe mode, import and export, migration from Code Snippets, and a one-time import from a public GitHub repository.
- Premium — everything in Pro, plus tracked GitHub collections (public and private) with update checks and reviewed updates, automatic updates, and management through the Abilities API, REST and AI assistants.
- Agency — everything in Premium, for more sites.
The plugin needs an active license or trial to run. When a license expires, everything keeps working, including your snippets; you stop receiving plugin updates and support until you renew. If you move from Premium to Pro, snippets that came from GitHub collections stay on the site and keep running, but they are no longer synced or updated.
Requirements #
- WordPress 6.0 or higher
- PHP 8.0 or higher
- Write access to
wp-content/uploads/(used for generated snippet files)
Installation #
- Upload the
gravityops-code-snippet-managerfolder towp-content/plugins/. All plans use this same premium-only plugin package. - Activate the plugin from the WordPress Plugins screen.
- Open GravityOps > Code Snippets in the WordPress admin menu. The same screen is also reachable from the Code Snippet Manager tile on the GravityOps dashboard.
This documentation is also available right in your dashboard under the Docs tab of the Code Snippet Manager page.
On activation the plugin creates its database tables and verifies that wp-content/uploads/gocsm/ is writable. If the check fails, an admin notice appears and Settings > Runtime diagnostics shows “Generated files writable: No”. The check runs on activation, so deactivate and reactivate the plugin after fixing permissions. On multisite, network activation sets the plugin up on every site, and each site keeps its own snippets.
How snippets are executed #
Active PHP snippets are generated as .php files in wp-content/uploads/gocsm/snippets/ and registered on the WordPress action hook configured in the snippet scope. When the hook fires, GOCSM verifies the generated file hash and loads it with require_once. This gives you OPcache benefits, real stack traces, and compatibility with security scanners in the normal path.
Active JavaScript and CSS snippets are generated as external files in wp-content/uploads/gocsm/js/ and wp-content/uploads/gocsm/css/, then enqueued with WordPress. Active HTML snippets are generated in wp-content/uploads/gocsm/html/ and printed at their chosen page location, or wherever their shortcode or HTML Snippet block is placed.
See the Eval Fallback Mode doc if your host does not allow generated PHP files to be written.
AI assistants and the Abilities API #
On WordPress 6.9 and later, with the Premium or Agency plan, GOCSM can be managed through the WordPress Abilities API, and so over REST and by AI assistants: listing, editing, activating and updating snippets, collections, folders, revisions and settings. Writing new code over the API is off unless you allow it in wp-config.php. See Abilities API, REST and AI Assistants.