About this plugin
Moving from Code Snippets to Fluent Snippets? This plugin copies your snippets across, puts each one in the right place, and tells you which ones need a look before you switch them on.
It started as a Python script of mine. This is the same idea, inside WordPress.
How it works
- Go to Tools > CS2FS Converter. You’ll see all your snippets, what each one becomes in Fluent Snippets, and any notes.
- Untick the ones you don’t want and click Generate. You get a JSON file to keep as a backup.
- Open Fluent Snippets and click “Import local”. Done.
Everything arrives as a draft, so nothing runs twice while Code Snippets is still active. When you’re ready, deactivate Code Snippets and publish the snippets you need.
What carries over
- The code, name, description, tags and priority.
- The right type and location for every kind of snippet: PHP, CSS, JavaScript, and HTML for the head, body or footer.
- Which snippets were active, so you know what to publish.
What needs a look
The converter flags these, both on the list and after the import:
- Snippets with a condition (Code Snippets 4). Fluent Snippets has its own conditions, so set them up again there.
- Single-use snippets. Fluent Snippets has no “run once”, so a published one runs on every page load.
- Content snippets. Pages using [code_snippet] need the Fluent Snippets shortcode instead.
Snippets in the trash are left out.
Once you’ve moved everything, delete this plugin. You only need it once.
Where each snippet goes
- Run everywhere: PHP, everywhere
- Only run in the admin: PHP, admin only
- Only run on the site front-end: PHP, everywhere, with a check that stops it in the admin
- Only run once: PHP, everywhere (flagged)
- Content (shortcode): PHP + HTML, shortcode (flagged)
- Head, body and footer content: PHP + HTML in wp_head, wp_body_open or wp_footer
- Admin and site CSS: CSS in admin_head or wp_head
- Head and footer JavaScript: JS in wp_head or wp_footer
You can still change the type of any snippet on the list before exporting.