Switch from Code Snippets
Snipfire imports snippets from Code Snippets and Code Snippets Pro, and switches them over in one click. Read Switching from another snippet plugin first for how importing, Check first and Switch over work.
Steps
- Snipfire → Snippets → Import, then pick Code Snippets.
- Select the snippets and click Import … selected. They arrive switched off in Imported/Code Snippets.
- Look at anything marked Check first.
- Click Switch over.
- Clear your page cache, check the site, then deactivate and delete Code Snippets.
Command line: wp snipfire import-from code-snippets --dry-run, then --switch.
What comes across
| Code Snippets | In Snipfire |
|---|---|
| Name, description, tags, priority | Title, description, tags, priority |
| Run snippet everywhere | PHP on plugins_loaded, priority 1 (where Code Snippets runs them) |
| Only run in administration area / Only run on site front-end | The same, plus a Request type condition |
| Only run once | Only when I click Run |
| HTML content: Display with shortcode | HTML, As a shortcode |
| HTML content: Load in site head / Load in site footer | HTML in Site header / Site footer |
| Pro CSS and JavaScript snippets | CSS and JavaScript snippets on the matching location |
Code Snippets' own table is read directly, so the plugin doesn't need to be active. Saved Pro conditions (not snippets) are skipped.
Shortcodes
[code_snippet id="…"] keeps working after switching over, even with Code Snippets deleted.
If a post uses the shortcode with PHP enabled (php=yes), the snippet is imported with its PHP running. Shortcode attributes are in $atts['name']; Code Snippets also made them plain variables, so check snippets that used $name directly.
Marked "Check first"
- Snippets that used a Code Snippets Pro condition. The condition isn't imported: add conditions in Snipfire before switching them on.
Not imported
- Snippets in the trash.
- A scope Snipfire doesn't know (the reason is shown).
Switching over
Snipfire switches each snippet off in Code Snippets (through Code Snippets' own functions when it's active, so its caches stay right), then switches the copy on and test-loads the site.
Something unclear or missing? Tell us