Snippet scopes
A scope tells SnipCraft where a snippet should execute — front end, admin, or both. Picking the right scope prevents unnecessary code from running on every request.
What a scope is
Every snippet in SnipCraft has a scope that controls where it executes. WordPress serves two distinct environments in every request: the visitor-facing front end and the wp-admin backend. A scope is a hard gate — a snippet assigned to one environment will never run in the other, regardless of any other setting.
The three scopes
Everywhere
The snippet runs on both the front end and in wp-admin. Use this only when code genuinely needs to be active in both environments — for example, a filter that modifies data regardless of context.
Frontend only
The snippet runs exclusively on visitor-facing pages. It is never loaded during admin requests, so it has no performance impact on dashboard use. This is the right choice for output modifications, shortcodes, and anything that changes what site visitors see or experience.
Admin only
The snippet runs exclusively inside wp-admin. It is never loaded on the front end, keeping your public page performance clean. Use this for dashboard customisations, admin column tweaks, editor enhancements, and similar back-office behaviour.
Choosing a scope
A simple rule covers most situations: use Admin only for dashboard tweaks and back-office behaviour; use Frontend only for anything that affects visitor-facing output; use Everywhere only when a snippet genuinely must run in both environments.
- Admin-only for dashboard tweaks and wp-admin customisations
- Frontend-only for visitor-facing output, shortcodes, and asset injection
- Everywhere only when code must run in both environments
Scopes vs. run-when conditions
A scope is the coarse gate — it splits execution between front end and admin. For finer targeting within those environments (specific pages, post types, user roles, or custom logic), SnipCraft Pro provides run-when conditions: a rule builder that lets you attach precise execution conditions to any snippet. Read the full reference in run-when conditions.