View Categories

Snippet Not Running

Work through this checklist if a snippet is active but its code does not appear to execute.

1. Check the status #

In the snippets list, confirm the status column shows Active (green). If it shows Error, click Edit to see the error message. A snippet marked Orphaned (removed from its GitHub collection’s manifest) does not run either.

2. Check the context #

PHP snippets have a Context scope setting. If set to Frontend only, the snippet will not run in the admin and vice versa. Admin only and Frontend only also skip AJAX requests, and Frontend only skips REST requests. Make sure the context matches where you are testing.

3. Check the hook #

The snippet runs on the WordPress action hook specified in the Scope card. If your code depends on data that is only available later in the page lifecycle (e.g. post meta), the hook may be firing too early. Try switching to wp or template_redirect for frontend hooks.

4. Check the priority #

If another plugin or theme hooks the same action later, it may override your snippet’s output. In WordPress, lower priority numbers run earlier and higher priority numbers run later. Raise the priority number if your snippet needs to run after other callbacks.

5. Check page targeting (JS/CSS/HTML) #

JS, CSS, and HTML snippets can have page targeting rules. If any rules are set, the snippet only loads on matching pages. Remove all targeting rules temporarily to test.

An HTML snippet set to Start of body prints nothing if the theme does not call wp_body_open(); try Footer instead.

6. Check requirements #

If the snippet uses functions from Gravity Forms, GravityView, or another plugin, that plugin must be active. Snippets from a GitHub collection can declare required plugins; if one is missing at activation, the snippet is set to Error with a message such as “Requires active plugin: …”. Requirements are not re-checked after activation, so deactivating a required plugin later is not caught.

7. Check the generated file #

For PHP snippets, navigate to wp-content/uploads/gocsm/snippets/ in your FTP client or file manager and confirm the file exists for your snippet. JS files are in wp-content/uploads/gocsm/js/; CSS files are in wp-content/uploads/gocsm/css/; HTML files are in wp-content/uploads/gocsm/html/.

If a PHP generated file is missing and eval fallback is enabled, the snippet may still run via eval (see Eval Fallback Mode for when the (eval) badge appears). If eval fallback is disabled, a missing generated file moves the snippet to Error. A generated file that was changed on disk outside GOCSM, or that has no recorded hash, also moves the snippet to Error with a “Generated file hash mismatch” message. Deactivating and reactivating the snippet regenerates the file and records a fresh hash.

8. Check the sync log #

The Sync Log tab records activation events, errors, and update events. Look for recent entries related to your snippet.