Install a snippet
Every snippet page lists a Type and a Status. The type decides where the file goes; the status decides whether you should trust it.
| Type | Where it goes | Notes |
|---|---|---|
mu-plugin | wp-content/mu-plugins/ | Always loaded, cannot be deactivated from the admin. Create the folder if it does not exist. |
plugin | wp-content/plugins/<snippet-name>/ | Give it its own folder and keep the file name as published. |
snippet | WP Codebox, Code Snippets, or any snippet manager | Paste the file contents without the opening <?php. |
script | Wherever you include it from | A plain PHP file, not a WordPress entry point on its own. |
Steps
- Open the snippet page and use the Source link to download the
.phpfile. - Copy the file to the location above for its type.
- Check the header for site-specific values you must change, such as
Author URIor a log path. - Read the Status row:
Completemeans the snippet was verified on a live site,WIPandUnknownmean try it on staging first.
Removing a snippet
Delete the file. Every snippet gates itself with the usual defined( 'ABSPATH' ) or die()
guard, so nothing else is left behind. Snippets that write log files can leave those
behind in the uploads directory or the mu-plugins directory - delete them too.