Your WordPress Snippets Are Not in Your Deploy
WPCode and Code Snippets keep your PHP in the database; FluentSnippets and mu-plugins keep it in files. What that means for deploys, recovery and who can edit.

Where do WordPress snippets live, and does that decide whether they ship with your deploy? It does. WPCode and Code Snippets keep your PHP in the database, so a git push never carries it. FluentSnippets keeps each snippet as a PHP file in wp-content/fluent-snippet-storage, and an mu-plugin is a file by definition. Everything else in this guide follows from that one split: what a deploy moves, what a code review sees, how you recover from a bad snippet and who can write code on your site.
Clone the repository for a site you did not build and read every file. You still will not know what the site does, because a snippet saved in a database row is not in the repository you just read. It has no diff, no author you can trust and no second pair of eyes. This page was first published in September 2026 and keeps its title, but we rebuilt it on 15 November 2026 around the three snippet plugins people actually install, the official mu-plugins rules and the two 2026 advisories that matter here. Every number, version and date was rechecked that day.
Where does each snippet plugin store your code?
We read the current source of each plugin and the WordPress.org plugin API on 15 November 2026. The storage answer for each one is in the plugin’s own documentation as well.
Option | Where the code is stored | Moves with a git deploy? | Source |
|---|---|---|---|
WPCode (Insert Headers and Footers + Custom Code Snippets) | Database. Each snippet is a post of type | No | Plugin FAQ and source, version 2.4.2 |
Code Snippets | Database table | No | Plugin FAQ and source, version 4.1.0 |
FluentSnippets (WordPress.org slug | Files. One PHP file per snippet in | Yes, if that folder is in your repository | Plugin FAQ and source, version 10.58 |
mu-plugin | A PHP file in | Yes | developer.wordpress.org |
Theme | A file in the active theme. | Yes, but it leaves with the theme | WordPress core behaviour |
The Code Snippets and WPCode rows are the ones that surprise teams. Both plugins are well maintained, and neither is doing anything wrong. They simply chose the database, and the database is a different deployment path from your code.
How do WPCode, Code Snippets and FluentSnippets compare today?
These are the figures the WordPress.org plugin API returned on 15 November 2026. Ratings are the API’s percentage converted to five stars. The support figure is the share of recent support threads marked resolved, and with only a handful of threads it is a rough signal, not a score.
Plugin | Version | Last updated | Active installs | Rating | Support threads resolved | Tested up to |
|---|---|---|---|---|---|---|
2.4.2 | 12 Nov 2026 | 3+ million | 4.9 of 5 (1,928 ratings) | 6 of 8 | WordPress 7.1.4 | |
4.1.0 | 6 Nov 2026 | 1+ million | 4.7 of 5 (510 ratings) | 12 of 18 | WordPress 7.1.4 | |
10.58 | 23 Oct 2026 | 50,000+ | 4.7 of 5 (79 ratings) | 2 of 3 | WordPress 7.1.4 |
WPCode needs PHP 7.0 or newer, Code Snippets 7.4 or newer and FluentSnippets 7.3 or newer, all well below the PHP 8.3 or newer that WordPress.org recommends for any site today.
How do mu-plugins load, and how is that different from a snippet plugin?
The official developer documentation (page last updated 14 October 2026) gives the rules, and they are short:
- A must-use plugin is a PHP file in
wp-content/mu-plugins. It is enabled automatically on every site in the installation, with no activation step. - PHP loads them in alphabetical order, before regular plugins. A hook added in an mu-plugin can therefore apply to normal plugins.
- WordPress only looks at PHP files directly inside that folder. A file in a subdirectory is not loaded, so the documented pattern is a small loader file such as
load.phpthat requiresmy-plugin/my-plugin.php. - They cannot be switched off in wp-admin. They show in a separate Must-Use list on the Plugins screen, and to disable one you remove the file.
- Activation, deactivation and uninstall hooks do not run for them, and they get no update notices, so you update them yourself.
- To move the folder, define
WPMU_PLUGIN_DIRandWPMU_PLUGIN_URLinwp-config.php.
The documentation also states when not to use one: code that needs to be activated or deactivated from wp-admin, code that relies on activation hooks, and anything meant to be optional. That last point is the honest limit of the migration advice below. A snippet your marketing team toggles every week is not an mu-plugin.
Our mu-plugins guide goes deeper on the loader file and the load order.
What happens when a snippet breaks the site?
Recovery is where the three plugins differ most, so know the route before you need it. We checked each against its source and, for the first two, against a support reply from the plugin team.
Option | Automatic protection | If you are locked out | Checked in |
|---|---|---|---|
WPCode | Runs the code when you activate a snippet and blocks activation if it throws a fatal error, per the plugin team on WordPress.org. | Add | Plugin source and a support reply dated 5 Oct 2026 |
Code Snippets | Safe mode is available from the Snippets screen. | Open | Plugin source and a support reply dated 25 Oct 2026 |
FluentSnippets | Catches a fatal error, deactivates that one snippet and reports the line, per the plugin description. | A Safe Mode URL with a secret key, shown in the plugin. The | Plugin description and source |
mu-plugin | None. A fatal error in an always-loaded file stops the whole site. | Rename or delete the file over SFTP or SSH. There is nothing to click, and no database to reach. | Developer documentation |
Two things follow. First, the database plugins give you a way back in without file access, which is a real advantage on a host where you only have wp-admin. Second, an mu-plugin gives you no safety net at all, so it needs the review and the staging run that a database snippet usually skips. If you paste code from an AI assistant into either, run it through our ten checks for AI-written snippets first.
Can you keep snippets in version control and deploy them?
With files, yes, directly. With the database, only by exporting, and only if someone does it.
Files: FluentSnippets and mu-plugins
Commit wp-content/mu-plugins and, if you use FluentSnippets, the storage folder. Each snippet is a PHP file with its title and conditions in a comment block at the top, so a diff is readable. One catch is documented by the plugin team on WordPress.org: FluentSnippets builds a registry file from the snippet files for speed, and when files are renamed, removed or restored by hand the registry can disagree with the folder. A deploy that adds or deletes snippet files should be followed by opening the plugin screen or checking the list, so you know the registry matches. If your deploy overwrites the whole wp-content folder, it will also erase any snippet someone saved in the admin since the last release, which is the same drift problem as the database, in a new place.
Database: WPCode and Code Snippets
Both can export. WPCode has an Export Snippets tool on its Tools screen for a file you can import elsewhere. Code Snippets exports to its own format and, per its FAQ, can export selected PHP snippets as a single PHP file with the snippet names and descriptions in comments, which is the cleanest first step towards an mu-plugin. Commit the export as a record, then review it like any other pull request.
To see drift between staging and production, compare a list from each environment. Checked on 15 November 2026:
# WPCode: id, title and status (publish = active, draft = inactive)
wp post list --post_type=wpcode --post_status=any \
--fields=ID,post_title,post_status --format=csv | sort > snippets-$(hostname).csv
# Code Snippets: the table name follows your table prefix
wp db query "SELECT id, name, scope, active, modified FROM $(wp db prefix)snippets ORDER BY id" > snippets-$(hostname).txt
# FluentSnippets: it is just a folder
ls -l wp-content/fluent-snippet-storageRun the same command on each environment and diff the two files. Titles and modified dates will not prove two snippets have identical bodies, but a snippet that is active on production and missing on staging tells you exactly which behaviour your staging tests cannot speak for.
Who can edit PHP on your site, and does DISALLOW_FILE_EDIT stop it?
It does not. This is the most common wrong assumption we see. DISALLOW_FILE_EDIT makes WordPress core refuse the edit_files, edit_plugins and edit_themes capabilities, which removes the theme and plugin file editors from wp-admin (we checked capabilities.php in WordPress core). A snippet plugin does not use those editors. It has its own screen and its own capability check, so on a site with that constant set, an administrator can still save PHP that runs on every request. The developer documentation says the constant is there as an extra layer if someone gets into a well-privileged account, and a snippet plugin is a second door into the same room.
Option | Capability that opens the editor (from source) | Effect of DISALLOW_FILE_EDIT | Effect of DISALLOW_FILE_MODS |
|---|---|---|---|
WPCode | Its own | None, it uses its own capability | None that we found in the source |
Code Snippets |
| None | None that we found in the source |
FluentSnippets |
| None | Editing is refused. The screen becomes read-only and active snippets keep running. |
mu-plugin | Whoever can write files on the server | Not applicable | Not applicable |
DISALLOW_FILE_MODS is the stricter constant: per the developer documentation it also disables the plugin and theme editors, and it blocks plugin and theme installs and updates. FluentSnippets is the only one of the three whose own source handles it explicitly, treating it as a reason to show the snippet list read-only. That is a sensible reading of the constant: if nothing may write to wp-content, a plugin that writes a file per snippet should not either. For the other two, if you want to lock editing to a short list of people, use their capability settings or filters, and test it with a non-admin account.
For a locked-down production site the clean setup is the one that matches how you deploy. Code goes through your pipeline into files, DISALLOW_FILE_MODS is on, and a snippet plugin is either absent or limited to a trusted few. Our update policy guide covers the other half of keeping many sites steady.
Which published security advisories involve snippet plugins?
A plugin that executes stored code is a high-value target, so we looked for published advisories rather than relying on opinion. We found two for WPCode in 2026 and confirmed both on cve.org on 15 November 2026. We found nothing we could verify to say about the other two plugins, so we say nothing.
ID | Plugin and affected versions | What it is | Published | Source |
|---|---|---|---|---|
CVE-2026-8832 | WPCode up to and including 2.3.5. The CVE record does not name a fixed version. The 2.4.2 source registers the | Authenticated remote code execution. The post type had no custom capabilities, so an author-level user could create a snippet post through XML-RPC | 27 May 2026 | Wordfence, via the CVE record |
CVE-2026-101301 | WPCode from 2.0.0 and before 2.4.0 | Safe mode could be entered by unauthenticated visitors, letting them disable the site’s auto-inserted snippets for their own requests. WPCode 2.4.0 notes that only users who can manage snippets can now load the site with snippets disabled. | 14 Oct 2026 | WPScan, via the CVE record |
What to take from them, without overreading. The first shows why a database snippet system has a larger surface than a file: the code is reachable through the same posts API as any other content, so its capability model has to be exactly right. The second is subtler. If a snippet is your only guard on something, for example a rule that blocks a page, a safe-mode bypass would have let a stranger see the page without it for the length of their own request. That is our inference, not part of the advisory. Whatever you run, keep it on the current version: WPCode is on 2.4.2 as of this writing.
How do you audit a site that already has snippets?
Query the running site. These WP-CLI commands are read-only. Checked on 15 November 2026.
# Which snippet plugins are active?
wp plugin list --status=active --fields=name,version \
| grep -iE "snippet|wpcode|insert-headers|easy-code-manager"
# mu-plugins that load on every request
wp eval 'foreach ( wp_get_mu_plugins() as $f ) { echo basename( $f ), PHP_EOL; }'
# AJAX actions open to logged-out visitors
wp eval 'global $wp_filter;
foreach ( array_keys( $wp_filter ) as $h ) {
if ( 0 === strpos( $h, "wp_ajax_nopriv_" ) ) { echo $h, PHP_EOL; }
}'Save the output. The last list is your genuinely open surface, and it is a better picture of risk than a plugin count. Compare it again when an advisory lands. Then run the storage-specific command from the earlier section for whichever snippet plugin you found, and read what is actually in there. For many sites that is the first time anyone has.
How do you move snippets into an mu-plugin without breaking the site?
The order matters more than the technique.
- Export first. Use the plugin’s own export and commit the file as a record. Disabling things without an undo is how a quick tidy turns into an outage.
- Group before you move. Twenty snippets are rarely twenty ideas. They are usually four or five, with near-duplicates added because it was easier to add than to find. Merge while you move.
- Move one group, deploy, verify, then disable the original. For a short window the code exists in both places, and a hook added twice fires twice. Keep the window short and test the specific behaviour.
- Check what runs earlier. An mu-plugin loads before regular plugins and before
plugins_loaded. Code that calls a function a plugin defines, or a pluggable function likeis_user_logged_in(), at file scope will fatal. Registering a hook at file scope is fine. Calling something at file scope is not. - Delete last. A disabled snippet comes back in one click. A deleted one does not, until the export saves you.
A worked example
A snippet found in WPCode titled “hide prices for guests”:
add_filter( 'woocommerce_get_price_html', function ( $price, $product ) {
return is_user_logged_in() ? $price : '<span class="login-for-price">Log in for pricing</span>';
}, 10, 2 );Moved to wp-content/mu-plugins/acme-guest-pricing.php it becomes a named function with escaped, translatable output. We checked it with php -l on 15 November 2026.
<?php
/**
* Plugin Name: Acme Guest Pricing
* Description: Replaces the price with a login prompt for logged-out visitors.
*/
defined( 'ABSPATH' ) || exit;
add_filter( 'woocommerce_get_price_html', 'acme_guest_price_html', 10, 2 );
function acme_guest_price_html( $price, $product ) {
// is_user_logged_in() is defined later than mu-plugins load, so call it
// inside the callback, never at file scope.
if ( is_user_logged_in() ) {
return $price;
}
return '<span class="login-for-price">' . esc_html__( 'Log in for pricing', 'acme' ) . '</span>';
}
The behaviour is the same. What changed is that it now has a filename, a commit and a reviewer. The closure became a named function so a child theme or a test can call remove_filter() on it, and the output is escaped, which nobody notices in an admin textarea and any reviewer notices in a diff. Because the filter is registered at file scope but the login check runs inside the callback, nothing calls a late-loading function too early.
When is a snippet plugin still the right choice?
- The site has no deployment pipeline. If the alternative is the theme file editor on production, a snippet plugin with safe mode is better.
- The code is temporary. A redirect for a three-week campaign or a maintenance notice. The test is whether you would mind finding it still running in a year.
- Non-developers need to toggle it. Tracking pixels and header scripts that marketing changes weekly belong in a UI. The official documentation lists “needs activation or deactivation from wp-admin” as a reason not to use an mu-plugin.
- You do have a pipeline, but only for the application. Keep the small, optional pieces in a plugin and the rules that must always run in files.
For small tweaks that a core filter already covers, you may not need either; see our filters that replace plugins and snippets.
It is the wrong choice when the plugin exists as a way around a pipeline you already have. That is process debt with a friendly screen on it, and the bill goes to whoever inherits the site.
Which should you use? A decision table
Your situation | Use this | Why |
|---|---|---|
Rule that must always run: security headers, a required filter, disabling a core behaviour | mu-plugin | Always loaded, cannot be switched off by accident, in git. |
Small PHP tweaks, no pipeline, one or two people on the site | Code Snippets or WPCode | Safe mode without file access, simple toggles. Accept that the code is in the database and export it now and then. |
Header and footer scripts that marketing edits | WPCode | The plugin is built around script insertion and has a snippet library. Keep PHP out of that role. |
You want snippets in git but a UI to manage them | FluentSnippets | Files you can commit, with an error handler and a safe mode URL. Mind the registry file after a deploy. |
Behaviour shared by several sites, or with its own settings | A real plugin | Header, version and changelog, so you fix a bug once. |
How the site looks | Theme | Template logic belongs there. Business logic that would outlive a redesign does not. |
Locked-down production, | mu-plugin or deployed files | Nothing in the admin should write code. FluentSnippets goes read-only here, by design. |
There is no row for “leave important code in the database”, because for code you intend to keep it is never the right answer.
What users say, and our suggestion
Review figures are from WordPress.org on 15 November 2026. We read the newest reviews and recurring support threads from the past twelve months and paraphrase them. Most reviews on all three plugins are five stars, so the useful signal is in the few that are not, and in what the plugin teams said in support.
WPCode
Rating 4.9 of 5 from 1,928 reviews, 3+ million active installs, updated 12 November 2026, 6 of 8 recent support threads resolved.
- Praised: reviewers say it is easy for people who are not developers, that code goes where it should without fuss, and that the ready-made snippet library beats copying code from forums. One WooCommerce shop owner like this review of 10 Nov 2026 values having every tweak in one place with a switch.
- Complained about: we found no one or two star reviews dated in the last twelve months. The recurring complaints sit in support instead: a new active snippet with an error is lost on save, which the team explained and answered with save first, activate second (9 Jun 2026); and an AJAX fatal on one site (20 Aug 2026) that the team said version 2.3.9 addressed.
Code Snippets
Rating 4.7 of 5 from 510 reviews, 1+ million active installs, updated 6 November 2026, 12 of 18 recent support threads resolved.
- Praised: long-term users say it has worked for years on many sites and keeps custom code out of
functions.php, with a toggle to turn a snippet off. - Complained about: a 3-star review of 20 Aug 2026 says the free version only handles PHP and HTML, which the plugin’s own FAQ confirms: CSS and JavaScript snippet types are in Pro. Support threads from October and November 2026 show version 4.0 growing pains, including multisite save problems and file-based execution issues, with fixes promised for 4.1.1.
FluentSnippets
Rating 4.7 of 5 from 79 reviews, 50,000+ active installs, updated 23 October 2026, 2 of 3 recent support threads resolved. That is a small base, so treat the numbers as thin.
- Praised: reviewers like that it is free with no upsell, that files load with WordPress, and that error messages are clearer after the August 2026 redesign. One reviewer disclosed the developer had emailed asking for reviews, which explains a cluster of five-star ratings that month.
- Complained about: a 3-star review of 30 Aug 2026 says groups cannot be renamed and the list is hard to scan. Support threads describe a snippet list that lags behind after files are deleted or restored by hand.
Our suggestion
- You deploy with git and want snippets in the repository: FluentSnippets for the ones non-developers must edit, mu-plugins for the rest. Budget for the registry caveat.
- You have no pipeline and want the biggest community: WPCode if header and footer scripts are the main job, Code Snippets if it is mostly PHP. Both are fine, and both need a habit of exporting.
- You are on a locked-down host with
DISALLOW_FILE_MODSset: do not rely on any snippet plugin for edits. Deploy files. - You are unsure: start with the audit commands above. What you find in the database will usually tell you more than any comparison table.
We do not sell a snippet plugin, so none of this is sponsored.
Common mistakes people report
Recurring problems from the WordPress.org support forums and plugin issue threads, paraphrased, checked on 15 November 2026.
- Getting locked out by a pasted snippet. It is the most common thread on both big plugins, for example WPCode, 5 Oct 2026 and Code Snippets, 25 Oct 2026. The fix in both cases was safe mode. Write the safe-mode URL or constant into your runbook before you need it.
- Activating and saving a new snippet in one step. WPCode runs the code during the save, so a fatal error can interrupt the save itself and the work is lost. Save inactive, then activate.
- Declaring the same function in two snippets. A FluentSnippets thread of 4 Jun 2026 ended in a Cannot redeclare fatal. Wrap named functions in
if ( ! function_exists( 'name' ) ), or better, merge duplicates. - Turning on file-based execution and trusting it. A Code Snippets thread of 17 Sep 2026 reports snippets that kept running after deactivation. The team tracks it as GitHub issue 561 and advised leaving the option off until a fix ships. Test deactivation, not just activation.
- Editing the FluentSnippets folder by hand and expecting the list to follow. The plugin team’s reply on a 4 Jun 2026 thread blames a mismatch between the files and the generated registry. If your deploy touches that folder, check the list afterwards.
- Assuming a page cache is not involved. The Code Snippets 4.1.0 changelog lists a fix for the snippet list showing stale state because REST responses were being cached by page caches. If a screen looks wrong after an update, purge before you debug.
Frequently asked questions
Are snippets stored in the database or in files?
It depends on the plugin. WPCode and Code Snippets use the database. FluentSnippets uses files. mu-plugins and theme functions are files.
Do mu-plugins load before regular plugins?
Yes. Per the developer documentation they load in alphabetical order before normal plugins, and WordPress core fires muplugins_loaded before plugins_loaded. Files inside subfolders are not loaded without a loader file.
Is FluentSnippets safer than WPCode or Code Snippets?
We cannot back that claim with an advisory, so we will not make it. File storage removes a table and a set of queries, and the plugin’s description says so. It does not change the basic risk: code that anyone with the right capability can write will run on your site. Capability, review and updates matter more than where the bytes sit.
Can a snippet plugin survive a theme change?
Yes. All three keep snippets outside the theme, and each plugin’s documentation says so. That is their main advantage over functions.php.
Should I delete snippet plugins once everything is in mu-plugins?
Only if nobody needs to toggle code from the admin. If you keep one, restrict who can edit snippets, keep it updated and export regularly. If you remove it, confirm every snippet was moved first. Code Snippets only removes its data on uninstall if you turn on Complete Uninstall, so check that setting.
Does DISALLOW_FILE_EDIT block WPCode or Code Snippets?
No. It removes core’s theme and plugin file editors. Snippet plugins use their own screens and capabilities. Use DISALLOW_FILE_MODS with a files-based deploy if you want to lock code changes down, and note that it also blocks plugin and theme updates from the admin.
Plugin versions, ratings and advisories change often. We recheck this page when one of these plugins ships a security fix, and the date near the commands is the last time all of it was verified.
Plugins we build and run
We maintain these ourselves, which is why we can support them on your site.
- BuddyNextThe self-hosted community engine for WordPress
- BuddyXFree community theme, Pro when you outgrow it
- ReignPremium community theme. Add pieces, build anything
- JetonomyCommunity forum and Q&A for WordPress
- EventonomyEvents and RSVPs for WordPress communities
- LearnomyCourses and learning communities on WordPress
- ListoraDirectories and listings your members can browse
- SnipShareCode sharing built for developer communities
- WB Ad ManagerAd placements that turn traffic into revenue
- WP Career BoardA job board your community actually uses
- WP Sell ServicesSell services with offers, orders, and payouts
- MediaVersePhotos, video, and media albums for members
- WB GamificationPoints, badges, and rewards that keep members active
- Product RoadmapPublic roadmaps with voting your users trust
Related Posts

LiteSpeed Cache Vulnerability CVE-2026-93389: Check Your Version and What Was Exposed

Freemius SDK Stored XSS: How to Find Every Bundled Copy on a Client Site (Anything Under 2.13.5)

