Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

All docs

The snippet library

Snipfire comes with a library of ready-made snippets for the things people ask for most: switching off XML-RPC, cleaning up the page head, a minimum order amount in WooCommerce, a Google Analytics tag. Install one, check it, switch it on.

  • 70 snippets in 10 packs. A pack is a set of snippets for one job, such as Harden WordPress. A snippet can be in more than one pack.
  • Included in the free plugin. The library ships with Snipfire: nothing is downloaded when you open it or install from it.
  • Written for Snipfire. Each snippet has a title, a description and notes on anything you need to know, and it's tested with the current WordPress (and WooCommerce where needed).

To browse the library before you install Snipfire, see snipfirewp.com/snippets.

The packs

Pack Snippets What's in it
Harden WordPress 7 Close the doors attackers try first: XML-RPC, user name discovery, the file editors, revealing login errors
Clean up the head 7 Remove the links, scripts and styles WordPress adds to every page that most sites never use
Performance 7 Small changes that save the server and the browser some work
Turn off what you don't use 9 Each replaces a small plugin: no comments, classic editor, no feeds, no search and more
Admin and login 8 Your branding on the login page, a tidier admin, and extras such as duplicating posts
Content and media 10 Shortcodes, links, images and small design touches for the public site
WooCommerce essentials 11 The small WooCommerce changes shop owners ask for most
Greek e-shop 6 For shops in Greece: receipt or invoice with a checked VAT number (ΑΦΜ), Greek phone and postcode checks, a cash on delivery fee, greeklish addresses and file names
Privacy and GDPR 4 Keep less personal data and send less of it to other companies
Analytics and pixels 6 The usual tracking codes, ready for your ID. Administrators' visits aren't counted

Several WooCommerce snippets are written for the classic checkout and templates. Their notes say so.

Open the library

  • In the editor, click Snippet library at the bottom of the sidebar. When you have no snippets yet, the empty editor also offers or start from the snippet library.
  • Or go to Snipfire → Tools & Safe Mode → Snippet library and click Open the snippet library.

On the left are All snippets, the packs, and (once you've installed some) Installed and Updates. Search the library finds snippets by their words. Show the code shows exactly what a snippet will add before you install it.

Install snippets

Click Install next to a snippet, or open a pack and click Install the pack, which installs every snippet in it you don't have yet.

Installed snippets:

  • arrive switched off, in the folder Library, tagged library,
  • keep the library's title, description, location and conditions, which you can change like any snippet's.

Look at each one, then switch it on in the editor. Switching on runs the usual checks and a test load of your site, as for any snippet. See How Snipfire keeps your site safe.

Switch on after installing

Tick Switch on after installing before you click Install to switch the new snippets on straight away. Snipfire checks them and test-loads your site once for all of them together. A snippet that fails the checks or the test load stays off, and the report after installing says why.

Some snippets always stay off after installing, even with the box ticked:

  • Needs your details: the snippet has something only you know, such as a tracking ID or an amount. When you open it in the editor, a note starting From the snippet library: says what to fill in, for example Replace G-XXXXXXXXXX (twice) with your measurement ID from Google Analytics > Admin > Data streams. Fill it in, save, then switch it on.
  • Needs WooCommerce (or another plugin): the snippet only works with that plugin. Install and activate it first.

Who can install what

Installing needs the same access as creating the snippet by hand. With Snipfire Pro's team access, people with CSS, JS and HTML (no PHP) can install the CSS, JavaScript and HTML snippets; the PHP ones show Not with your access.

Updates

When a new version of Snipfire brings a better version of a library snippet you installed, the snippet shows Update available, and the sidebar says Snippet library (1 update). Update one snippet with its Update button, or all of them at once with the Update all … snippets button at the top of the library. Updates on the left lists them.

An update is careful with your changes:

  • Settings you changed are kept. If you changed a snippet's location, priority or conditions after installing it, the update keeps your choice and takes the library's version of everything else. The report says which settings it kept.
  • The code always takes the library's version. If you had edited the code, your version is replaced, and the report says so. Your version is still in the snippet's history, one click away.
  • On stays on, off stays off. A snippet that's on is checked and test-loaded with the new version, and switched off if the new version fails.

Snipfire recognises a library snippet by a permanent ID, so updates also work for snippets that came to a site through Git sync or an export.

A snippet you changed shows Installed, changed here. Reset to library version puts the library's code back, keeping the settings you changed.

You can open the library at one snippet, with its code showing, by adding #/library?snippet= and the snippet's short name to your Snipfire editor's address:

https://example.com/wp-admin/admin.php?page=snipfire#/library?snippet=disable-xmlrpc

The snippet pages on snipfirewp.com/snippets use links like this. #/library/harden opens a pack.

Without JavaScript

The library also has a classic screen that works without JavaScript: on Tools & Safe Mode → Snippet library, click Classic version (works without JavaScript). Tick the snippets you want, choose Switch on after installing if you like, and click Install the ticked snippets.

From the command line

wp snipfire library packs                              # the packs
wp snipfire library --pack=harden                      # the snippets in a pack, and where you stand
wp snipfire library show disable-xmlrpc                # one snippet, with its notes and code
wp snipfire library install disable-xmlrpc year-shortcode
wp snipfire library install --pack=clean-head --activate
wp snipfire library update --all

Pack names for --pack: harden, clean-head, performance, turn-off, admin, content, woocommerce, greek-shop, privacy, tracking. See WP-CLI.

The library is also available through the REST API and to AI assistants.

Something unclear or missing? Tell us