Code Snippets
Code Snippets is a plugin that stores small pieces of PHP as separate, switchable entries, instead of you pasting them into your theme’s functions file.
In plain English
Every so often a tutorial tells you to add a bit of code to functions.php. Do that a few times and you have a file nobody can read, in a theme that will overwrite it at the next update.
Code Snippets keeps each piece separate, with a title, a description and an on switch. You can turn one off without touching the others.
Why it matters
It makes small customisations survivable. Something breaks, you switch the snippet off, the site comes back, and you work out why afterwards.
It also protects you from the classic disaster: an edit to functions.php with one character wrong, and a white screen you cannot log in to fix.
How it works
-
You add a snippetPaste the code, give it a name that says what it does, and save.
-
You choose where it runsEverywhere, admin only, front end only, or once.
-
It is activated separatelySaved and inactive is a perfectly good state while you read it over.
-
Errors are caughtThe plugin checks the code and refuses to activate something that would break the site.
Write down what each one is for
In two years you will not remember why snippet number nine exists, and you will be too nervous to delete it. One sentence in the description field prevents that.