Export and import
Snipfire exports snippets as a JSON file with their code, settings and conditions. Use it to copy snippets to another site or to keep a backup.
To move snippets from a different snippet plugin, use Switching from another plugin instead.
To run snippets on a site without Snipfire, export them as a plugin instead: a normal WordPress plugin, not a JSON file.
Export
- Everything: Export all at the bottom of the sidebar, or Tools & Safe Mode → Export → Export all snippets.
- One snippet: open it, then ⋯ → Export as JSON.
- From the command line:
wp snipfire export > snippets.json, or give IDs to export only some:wp snipfire export 12 15.
The file contains, for each snippet: title, description, type, code, location, priority, how it runs, shortcode, conditions, folder, tags, the settings form and its values, whether it was on, and its permanent snippet ID. Pro settings (testing mode, cookie consent, SCSS/LESS, a schedule, a CSS selector) are included too. Secrets never are.
Import
- Go to Tools & Safe Mode → Import.
- Choose the
.jsonfile and click Import. - The snippets arrive switched off, so nothing changes on the site yet. Review them and switch them on.
From the command line: wp snipfire import snippets.json. Add --keep-status to switch on the snippets that were on in the export (each is checked and the site is test-loaded, as with any switch-on).
Importing never overwrites existing snippets: each imported snippet is created as a new one, so importing the same file twice gives you two copies. Only Snipfire export files are accepted; anything else gets This is not a Snipfire export file.
What the export is good for
- Copying a snippet library to a new client site.
- A backup before big changes. Your normal site backup already includes the snippet files (see Requirements and storage), but an export is quick and easy to restore.
- Keeping snippets in version control. For a two-way, automatic setup, see Git sync (Agency).
- Sending snippets to many client sites. For pushing and tracking versions across sites, see the agency hub (Agency).
The file format is described in Storage, export format and constants.
Something unclear or missing? Tell us