Using Code Snippets with Zip AI
Sometimes you need a little custom code, a tracking pixel, a CSS tweak, a small function. Zip AI can write, add, and manage code snippets for you, so you don’t have to edit theme files or install a separate snippets plugin. Just describe what you want, and it does the rest.
What Can I Do with It?
A snippet is a small piece of custom code that runs on your site. Zip AI can create snippets in four languages:
- PHP — for behind-the-scenes functionality (custom logic, shortcodes, admin tweaks).
- JavaScript — for interactive behavior in the browser.
- CSS — for styling changes across your site.
- HTML — the go-to for analytics and marketing tags (Google Analytics, Google Tag Manager, Facebook Pixel, Hotjar, and similar).
You can also control where a snippet runs (the front end of your site, the admin area, the login page, or everywhere) and who it applies to (everyone, logged-in users, logged-out visitors, specific roles, or by device).
Prompts You Can Try
- Add my Google Analytics tag, ID G-XXXX
- Add CSS to make all my buttons rounded
- Show me all the snippets on my site
- Turn off the Facebook Pixel snippet
How It Works
You describe what you need; the assistant writes the snippet and asks for your approval before adding it. Once it’s live, Zip AI keeps track of it for you, you never have to manage files or remember where the code lives.
Every time a snippet is saved, a version snapshot is kept automatically, so you can look back at earlier versions and roll back if a change causes a problem.
What You Can Do to a Snippet
- Create a new snippet from a plain-English description.
- List all the snippets currently on your site.
- Edit / update an existing snippet.
- Enable or disable a snippet without deleting it.
- Delete a snippet you no longer need.
- Restore an earlier version from its history.
Safety & Limitations
- You approve every code change. Because snippets run real code on your site, adding or changing one always asks for your confirmation first.
- Dangerous code is blocked. The system rejects risky operations (things like exec, eval, and shell commands) before they can be saved.
- Placeholder IDs are caught. If a tracking tag still has a sample ID like G-XXXXXXX, it’s rejected so you don’t accidentally install a non-working tag.
- Secret warnings. If a snippet contains something that looks like a password or API key hard-coded in, you’ll get a heads-up.
- Keep snippets small. They’re meant for focused features, not large programs.
- Running raw PHP directly is not allowed — snippets are the safe, managed way to add custom code.
Related: Page-Level Scripts
Separate from site-wide snippets, the page editor also lets the assistant add custom JavaScript to a single page for interactive touches. That’s page-specific (see Vibe Editing), while snippets here run across your whole site.
FAQ
We don't respond to the article feedback, we use it to improve our support content.