<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WP-CLI | John Nessime</title>
	<atom:link href="https://john-nessime.com/blog/tag/wp-cli/feed/" rel="self" type="application/rss+xml" />
	<link>https://john-nessime.com/blog/tag/wp-cli/</link>
	<description>Cloud, DevOps, Data &#38; AI — Built, Tested, Explained</description>
	<lastBuildDate>Tue, 04 Aug 2026 12:05:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.3</generator>

<image>
	<url>https://john-nessime.com/blog/wp-content/uploads/2026/07/cropped-jn-32x32.png</url>
	<title>WP-CLI | John Nessime</title>
	<link>https://john-nessime.com/blog/tag/wp-cli/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>WP-CLI Commands That Save Hours (And the One That Bites Back)</title>
		<link>https://john-nessime.com/blog/technical-guides/wp-cli-commands-that-save-hours/</link>
					<comments>https://john-nessime.com/blog/technical-guides/wp-cli-commands-that-save-hours/#respond</comments>
		
		<dc:creator><![CDATA[John Nessime]]></dc:creator>
		<pubDate>Sun, 09 Aug 2026 13:00:00 +0000</pubDate>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Technical Guides]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[search-replace]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[WordPress Database]]></category>
		<category><![CDATA[WordPress Maintenance]]></category>
		<category><![CDATA[WordPress Migration]]></category>
		<category><![CDATA[WP-CLI]]></category>
		<category><![CDATA[WP-Cron]]></category>
		<guid isPermaLink="false">https://john-nessime.com/blog/?p=171</guid>

					<description><![CDATA[<p>The dashboard is fine for editing a post. It is a terrible tool for anything touching a thousand rows, twelve plugins or two servers. Here are the WP-CLI commands that save hours on migrations, plugin conflicts, stalled cron and integrity checks, grouped by the job that eats the time, with the failure modes each one hides.</p>
<p>The post <a href="https://john-nessime.com/blog/technical-guides/wp-cli-commands-that-save-hours/">WP-CLI Commands That Save Hours (And the One That Bites Back)</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">The ticket said &#8220;staging is approved, push it live.&#8221; Copy the files, import the database, change the two URL fields in Settings, done. The homepage loads. Then the slider is empty, a third of the images 404, and the page builder renders a grey box where a section used to be.</p>



<p class="wp-block-paragraph">That is the moment most people properly meet the command line, usually at the worst possible time. The dashboard is fine for editing a post. It is a bad tool for anything that touches a thousand rows, twelve plugins, or two servers at once.</p>



<p class="wp-block-paragraph">This is a working list of the WP-CLI commands that save hours, grouped by the job that eats the hours rather than by command name. Each section leads with the failure mode, because with a couple of these the command finishes, prints <code>Success</code>, and leaves you with a subtly broken database that nobody notices for a week.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The migration hour: search-replace, and the one that bites back</h2>



<p class="wp-block-paragraph">Changing a domain by running SQL against <code>wp_posts</code> is how sites break. WordPress stores a great deal of configuration as PHP serialized arrays, and serialized strings carry their own byte length. Change <code>https://old.example.com</code> to <code>https://new.example.org</code> with a plain <code>UPDATE ... REPLACE()</code> and the length prefix no longer matches the string. PHP refuses to unserialize the value, returns <code>false</code>, and the widget or page-builder section silently renders nothing.</p>



<p class="wp-block-paragraph">The whole point of <code>wp search-replace</code> is that it unserializes, replaces, and reserializes, so the lengths stay correct. Run it in dry-run mode first, every single time:</p>



<pre class="wp-block-code"><code>wp search-replace 'https://old.example.com' 'https://new.example.org' 
  --all-tables-with-prefix 
  --skip-columns=guid 
  --precise 
  --report-changed-only 
  --dry-run</code></pre>



<p class="wp-block-paragraph">What each flag is actually doing:</p>



<ul class="wp-block-list">
<li><code>--dry-run</code> runs the whole operation and prints the report without writing. The report has a &#8220;Type&#8221; column: <code>PHP</code> means the value was serialized and handled properly, <code>SQL</code> means a plain string replacement. If you expected hundreds of changes and see zero, your search string is wrong, not the tool.</li>

<li><code>--all-tables-with-prefix</code> widens the scope to every table sharing your prefix, not just the tables registered with <code>$wpdb</code>. Plugins that create their own tables live here. <code>--all-tables</code> goes wider still and will happily rewrite tables belonging to a completely different application sharing the database, so reach for the prefix version first.</li>

<li><code>--skip-columns=guid</code> is the one people leave off. The <code>guid</code> column is a permanent identifier for feed readers, not a URL to be followed. Rewriting it makes every historical post look brand new to anything that has subscribed to your feed.</li>

<li><code>--precise</code> forces PHP-side serialization handling on every column instead of letting MySQL do the simple cases. It is slower. On a large database it is noticeably slower. It is also the difference between &#8220;probably fine&#8221; and &#8220;definitely correct&#8221;.</li>

<li><code>--report-changed-only</code> trims the report to tables that actually changed, which makes the output readable instead of a wall of zeros.</li>
</ul>



<p class="wp-block-paragraph">Read the dry-run output. When the numbers look right, run the identical command without <code>--dry-run</code>.</p>



<h3 class="wp-block-heading">The step everyone forgets</h3>



<p class="wp-block-paragraph">You changed the database. Every cache layer still holds the old values. On a site with Redis or Memcached behind a persistent object cache drop-in, the old URLs will keep being served from memory and you will spend twenty minutes convinced the replacement failed.</p>



<pre class="wp-block-code"><code>wp cache flush
wp transient delete --expired
wp rewrite flush</code></pre>



<p class="wp-block-paragraph">Be aware that on multisite with a shared persistent object cache, <code>wp cache flush</code> can clear entries for every site on the network, not just the one you are working on. Then purge the page cache and the CDN through their own controls. If you are on Cloudflare, the database change means nothing until the edge cache is purged too.</p>



<p class="wp-block-paragraph">Finally, re-run the dry-run. It should report zero remaining replacements. If it does not, you have a second URL format hiding somewhere: protocol-relative <code>//old.example.com</code>, or an escaped form like <code>https://old.example.com</code> inside JSON stored in an option. Run a second pass for each shape you find.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The plugin conflict hour: bisect without touching the dashboard</h2>



<p class="wp-block-paragraph">Classic scenario: something fatals, the admin is white, and the usual advice is &#8220;deactivate all plugins and switch to a default theme.&#8221; On a production site that means real downtime while you click through a list.</p>



<p class="wp-block-paragraph">WP-CLI has two global parameters that skip loading plugins and themes for the duration of a single command. Nothing is deactivated. Nothing is written. The site keeps serving visitors exactly as it was.</p>



<pre class="wp-block-code"><code># Does WP-CLI work at all with nothing loaded?
wp --skip-plugins --skip-themes option get siteurl

# Is it the theme?
wp --skip-themes option get siteurl

# Skip one specific plugin
wp --skip-plugins=akismet option get siteurl</code></pre>



<p class="wp-block-paragraph">If the first command works and the unmodified one does not, the fault is in your plugins or theme, not in WP-CLI or WordPress core. From there you can walk the active list one at a time. This one-liner from the WP-CLI handbook does the walk for you:</p>



<pre class="wp-block-code"><code>wp plugin list --field=name --status=active --skip-plugins 
  | xargs -n1 -I % wp --skip-plugins=% plugin get % --field=name</code></pre>



<p class="wp-block-paragraph">The inner <code>--skip-plugins</code> on the listing command matters. Without it, a plugin broken badly enough to crash the bootstrap will also crash the command that is trying to build the list, and you get nothing.</p>



<p class="wp-block-paragraph">The honest limitation: skipping a plugin at the CLI does not reproduce browser-side behaviour. If the bug only appears for logged-in users on a specific admin screen, this narrows the field but will not fully confirm the culprit. It still turns a thirty-minute click-through into about two minutes of scrolling output.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The silent-cron hour: scheduled jobs that quietly stopped</h2>



<p class="wp-block-paragraph">This is the invisible failure. Nobody opens a ticket saying &#8220;cron is broken.&#8221; They open a ticket saying backups have not run since last month, or scheduled posts are stuck in the future, or order emails stopped going out. WP-Cron is not a scheduler. It is a queue that gets drained when someone loads a page, which means a low-traffic site drains it rarely and a fully page-cached site may never drain it at all.</p>



<pre class="wp-block-code"><code># Can the site reach its own wp-cron.php?
wp cron test

# What is scheduled, and how overdue is it?
wp cron event list

# Drain everything that is due, right now, in this process
wp cron event run --due-now</code></pre>



<p class="wp-block-paragraph">In <code>wp cron event list</code>, the column to read is <code>next_run_relative</code>. If events are showing as long overdue, the queue is not being drained and you have found your problem.</p>



<p class="wp-block-paragraph">The fix is to stop relying on page loads. Disable the loopback trigger in <code>wp-config.php</code>, above the &#8220;stop editing&#8221; line:</p>



<pre class="wp-block-code"><code>define( 'DISABLE_WP_CRON', true );</code></pre>



<p class="wp-block-paragraph">Then add a real system cron entry for the user that owns the site files:</p>



<pre class="wp-block-code"><code>* * * * * /usr/local/bin/wp --path=/var/www/example.com cron event run --due-now --quiet</code></pre>



<p class="wp-block-paragraph">Why the CLI form and not a <code>curl</code> of <code>wp-cron.php</code>: <code>wp cron event run</code> executes the events in the current PHP process. No HTTP loopback is involved, so it cannot be defeated by a firewall rule, a reverse proxy, HTTP authentication on staging, or a host that rate-limits self-requests. Errors surface in the cron mail or the log you redirect to, instead of vanishing into a request nobody reads.</p>



<p class="wp-block-paragraph">One warning. Set <code>DISABLE_WP_CRON</code> and then forget the crontab entry, and you have upgraded an unreliable scheduler into one that never runs at all. Verify with <code>wp cron event list</code> a few minutes later before you close the ticket.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The bulk-edit hour: piping IDs instead of clicking pages</h2>



<p class="wp-block-paragraph">The pattern that does the real work here is <code>--format=ids</code> feeding another command. Once that clicks, most &#8220;there is no plugin for this&#8221; tasks become one line.</p>



<pre class="wp-block-code"><code># How many revisions are we carrying?
wp post list --post_type=revision --format=count

# Delete them, skipping the trash
wp post delete $(wp post list --post_type=revision --format=ids) --force

# Every administrator on the site, in one table
wp user list --role=administrator --fields=ID,user_login,user_email

# Regenerate only the thumbnail sizes that are missing
wp media regenerate --only-missing --yes</code></pre>



<p class="wp-block-paragraph">Two things to know before you run the delete. It is irreversible, so take a database export first. And if the inner command returns nothing because there are no revisions, the outer command gets no arguments and will error rather than doing nothing quietly. That is a harmless failure, but it looks alarming the first time.</p>



<p class="wp-block-paragraph">Revisions come back unless you cap them. Adding <code>define( 'WP_POST_REVISIONS', 5 );</code> to <code>wp-config.php</code> keeps enough history to recover from a bad edit without letting <code>wp_posts</code> grow without limit.</p>



<p class="wp-block-paragraph">For anything you want to script rather than read, add <code>--format=json</code> and pipe it into <code>jq</code>. Every list command in WP-CLI supports it, which makes the whole tool usable as a data source for monitoring and reporting rather than just an admin replacement.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The &#8220;is this thing compromised?&#8221; hour: checksums</h2>



<p class="wp-block-paragraph">A site is behaving oddly, there is a suspicious redirect, and the first instinct is to install a security scanner. Before that, run the two commands that compare what is on disk against the official hashes on WordPress.org.</p>



<pre class="wp-block-code"><code>wp core verify-checksums
wp plugin verify-checksums --all</code></pre>



<p class="wp-block-paragraph">These download the published checksums for your exact version and locale and report every core or plugin file that has been modified, plus files that should not exist at all. The core command deliberately avoids loading WordPress, so it still works when the site itself is too broken to boot.</p>



<p class="wp-block-paragraph">Know the blind spots before you trust a clean result:</p>



<ul class="wp-block-list">
<li>Only plugins hosted on the WordPress.org directory can be verified. Premium plugins, custom code and anything from a private repository have no published source of truth and will be skipped or warned about.</li>

<li>Nothing in <code>wp-content/uploads</code> is covered. A dropped PHP file in an uploads subdirectory is a common backdoor and checksums will never see it.</li>

<li>Themes are not covered by an equivalent bundled command.</li>

<li>Getting a locale or version mismatch produces alarming warnings that are not real findings. Pass <code>--version</code> and <code>--locale</code> explicitly if the output looks wrong.</li>
</ul>



<p class="wp-block-paragraph">A clean checksum run is not proof the site is clean. A dirty one is proof it is not, which is worth a great deal in the first five minutes of an incident.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The database hour: find the bloat before you optimise anything</h2>



<p class="wp-block-paragraph">&#8220;The site is slow&#8221; is not actionable. &#8220;One table is carrying most of the database&#8221; is. Start by looking, not by running an optimiser.</p>



<pre class="wp-block-code"><code># Size per table, sorted by whatever is worst
wp db size --tables --human-readable

# Take an export before touching anything
wp db export ~/backups/example-com.sql

# Run a query and strip the ASCII table borders
wp db query 'SELECT option_value FROM wp_options WHERE option_name="home"' --skip-column-names</code></pre>



<p class="wp-block-paragraph">In practice the offenders are nearly always <code>wp_options</code> stuffed with autoloaded rows and orphaned transients, <code>wp_postmeta</code> from a plugin that never cleans up after itself, or <code>wp_posts</code> full of revisions. Autoloaded options are the sneaky one, because every row marked for autoload is loaded on every request, including requests that will never look at it.</p>



<p class="wp-block-paragraph">Two clean-up commands worth knowing, and the difference between them:</p>



<pre class="wp-block-code"><code>wp transient delete --expired
wp transient delete --all</code></pre>



<p class="wp-block-paragraph">The first removes only what has already expired and is safe to run on a schedule. The second removes everything, including live cache entries, which forces WordPress to rebuild them on the next requests. That is safe but produces a short performance dip, so it belongs in a maintenance window rather than in a cron job.</p>



<p class="wp-block-paragraph">Note that on a site with a persistent object cache drop-in installed, transients bypass the database entirely and wrap the object cache instead. If <code>wp transient delete --all</code> reports nothing, that is usually the reason and not a failure.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The setup that makes everything above faster</h2>



<p class="wp-block-paragraph">If you manage more than one site, the biggest single time saving is not a command at all. It is aliases. Put a <code>wp-cli.yml</code> in a project directory, or <code>~/.wp-cli/config.yml</code> for a global one:</p>



<pre class="wp-block-code"><code>@production:
  ssh: deploy@example.com/var/www/example.com
@staging:
  ssh: deploy@staging.example.com/var/www/staging</code></pre>



<p class="wp-block-paragraph">Now you run commands against a remote site from your own machine, without an SSH session:</p>



<pre class="wp-block-code"><code>wp @staging plugin list --status=active
wp @production cron event list</code></pre>



<p class="wp-block-paragraph">This needs WP-CLI installed on the remote host, and it needs your host to actually give you SSH. That varies more than people expect. A plain VPS from a provider like InterServer or DigitalOcean gives you root and you install what you like. Managed WordPress hosts differ: some ship WP-CLI preinstalled and hand you an SSH key immediately, others restrict which commands you can run, and a few give you no shell at all on entry-level plans. Worth checking before you build a workflow that depends on it.</p>



<p class="wp-block-paragraph">Two optional packages are worth the install if you do maintenance work regularly:</p>



<pre class="wp-block-code"><code>wp package install wp-cli/doctor-command
wp package install wp-cli/profile-command

wp doctor check --all
wp profile stage</code></pre>



<p class="wp-block-paragraph"><code>wp doctor</code> runs a set of health checks, including one for autoloaded options size, and gives you a pass or warn per check. <code>wp profile</code> breaks a request into stages so you can see where the time is going before you start guessing.</p>



<p class="wp-block-paragraph">The honest trade-off: these are separate packages, not bundled commands, and they get less attention than the core set. If you are working across client servers you do not control, installing packages everywhere is friction you may not want. On your own infrastructure they earn their place. For continuous visibility rather than point-in-time checks you still want proper monitoring, whether that is a self-hosted Prometheus and Grafana stack or a hosted uptime service.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Troubleshooting: when WP-CLI itself will not run</h2>



<p class="wp-block-paragraph">Before blaming the tool, run <code>wp cli info</code>. It prints the PHP binary in use, the PHP version, the loaded <code>php.ini</code>, and the WP-CLI version. Most problems are visible in that output.</p>



<ul class="wp-block-list">
<li><strong>&#8220;This does not seem to be a WordPress installation.&#8221;</strong> You are in the wrong directory, or the document root is elsewhere. Pass <code>--path=/full/path/to/wordpress</code> rather than guessing.</li>

<li><strong>Wrong PHP version.</strong> On a control panel server the shell PHP is often not the PHP the site runs on. Check the binary in <code>wp cli info</code>, and invoke the right one explicitly if they differ, for example <code>/usr/local/php83/bin/php $(which wp)</code>.</li>

<li><strong>Memory exhaustion on large operations.</strong> The CLI uses its own memory limit, not the web one. Raise it for a single command with <code>php -d memory_limit=512M $(which wp) ...</code> instead of editing configuration globally.</li>

<li><strong>A fatal error the moment you type anything.</strong> Confirm with <code>wp --skip-plugins --skip-themes cli info</code>. If that works, the fault is in site code.</li>

<li><strong>A warning about running as root.</strong> WP-CLI is telling you that files created by this command will be owned by root and the web server may not be able to write to them later. <code>--allow-root</code> silences the warning without fixing the ownership problem. Run as the site user instead, unless you are inside a container where root is the normal case.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Common mistakes</h2>



<ul class="wp-block-list">
<li>Running <code>search-replace</code> without <code>--dry-run</code> because you have done it before and it worked.</li>

<li>Reaching for <code>--all-tables</code> by reflex when <code>--all-tables-with-prefix</code> is what you meant, on a server where several sites share one database.</li>

<li>Forgetting to flush the object cache and CDN after a database write, then re-running the replacement several times chasing a ghost.</li>

<li>Setting <code>DISABLE_WP_CRON</code> without adding the system cron entry.</li>

<li>Treating a clean <code>verify-checksums</code> result as proof that a site is not compromised.</li>

<li>Running destructive commands over SSH without <code>screen</code> or <code>tmux</code>, then losing the connection mid-write on a large table.</li>

<li>Using <code>--allow-root</code> as a habit and leaving root-owned files scattered through <code>wp-content</code>.</li>
</ul>



<h2 class="wp-block-heading">Best practices</h2>



<ol class="wp-block-list">
<li>Export the database before any command that writes. <code>wp db export</code> takes seconds and has saved more afternoons than any other command in this post.</li>

<li>Dry-run first, read the report, then repeat the command verbatim without the flag. Do not retype it.</li>

<li>Run as the site user, not root, so file ownership stays correct.</li>

<li>Use aliases in <code>wp-cli.yml</code> so you cannot run a staging command against production by muscle memory.</li>

<li>Verify after the write. Re-run the read-only version of whatever you just did and confirm it reports zero remaining work.</li>

<li>Test the restore path, not just the backup. An export you have never imported is a hope, not a backup.</li>

<li>Keep WP-CLI current with <code>wp cli update</code>, particularly before working on a site running a recent PHP release.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Frequently asked questions</h2>



<h3 class="wp-block-heading">Is wp search-replace safe to run on a live site?</h3>



<p class="wp-block-paragraph">Safer than raw SQL, because it handles serialized data correctly. Still a write against production. Export the database first, dry-run first, and use <code>--skip-columns=guid</code>. On a large database the operation can hold the site in a slightly inconsistent state for the duration, so a quiet window helps.</p>



<h3 class="wp-block-heading">Why do my changes not show up after search-replace?</h3>



<p class="wp-block-paragraph">Almost always caching. Run <code>wp cache flush</code>, purge the page cache and the CDN, then reload. If the old value still appears in a dry-run report, you have a second URL format stored somewhere, such as a protocol-relative or escaped variant.</p>



<h3 class="wp-block-heading">Does WP-CLI need SSH access?</h3>



<p class="wp-block-paragraph">It needs shell access on a machine that can reach the WordPress files and database. That usually means SSH. Some managed hosts provide a browser terminal instead, and some restrict the available commands. On a self-managed VPS you install it yourself and nothing is restricted.</p>



<h3 class="wp-block-heading">What is the difference between &#8211;skip-plugins and deactivating a plugin?</h3>



<p class="wp-block-paragraph"><code>--skip-plugins</code> prevents the plugin from loading for that one command only. Nothing is written to the database and visitors are unaffected. Deactivating changes site state and takes the plugin offline for everyone, which is why the skip flags are the right diagnostic tool on production.</p>



<h3 class="wp-block-heading">Can I schedule WP-CLI commands with cron?</h3>



<p class="wp-block-paragraph">Yes, and that is the recommended way to run WordPress scheduled events reliably. Use the full path to the <code>wp</code> binary, pass <code>--path</code>, run as the site user, and redirect output so failures are visible rather than silent.</p>



<h3 class="wp-block-heading">Will verify-checksums detect all malware?</h3>



<p class="wp-block-paragraph">No. It compares core files and WordPress.org-hosted plugins against published hashes. It does not cover themes, premium or custom plugins, or anything in the uploads directory. Treat a failure as a definite finding and a pass as one data point among several.</p>



<h3 class="wp-block-heading">Which WP-CLI commands should I learn first?</h3>



<p class="wp-block-paragraph"><code>wp db export</code>, <code>wp search-replace --dry-run</code>, <code>wp --skip-plugins</code>, and <code>wp cron event list</code>. Those four cover backup, migration, conflict isolation and the most common silent failure on a WordPress site.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The one thing worth remembering</h2>



<p class="wp-block-paragraph">Most of the WP-CLI commands that save hours do it by turning a job you cannot see into a job you can read. <code>--dry-run</code> shows you the write before it happens. <code>wp cron event list</code> shows you a queue that was failing silently. <code>verify-checksums</code> shows you a file that changed without anyone deciding it should.</p>



<p class="wp-block-paragraph">The speed is real, but the speed is not the point. The point is that you stop guessing. If you take one habit from this post, take the dry-run: run the read-only version, read the output, then run the identical command for real. That single pattern prevents the majority of the incidents I see caused by command-line work on WordPress.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Need a hand with this?</h2>



<p class="wp-block-paragraph">I work on WordPress infrastructure, and command-line automation is most of what makes that maintainable. Things I can help with directly:</p>



<ul class="wp-block-list">
<li>Domain and host migrations run properly, with staged dry-runs, correct table scoping and a verified rollback before anything is written.</li>

<li>Replacing WP-Cron with real system cron across a fleet, including alerting when a job stops firing instead of finding out weeks later.</li>

<li>Writing repeatable WP-CLI maintenance scripts, with proper exit codes and logging, so they can be scheduled rather than remembered.</li>

<li>Diagnosing slow WordPress sites at the database layer, from autoloaded options and table bloat down to the query causing it.</li>

<li>Incident triage on a site suspected of being compromised, starting with integrity checks and file-level evidence rather than a scanner plugin.</li>

<li>Setting up multi-site management workflows with WP-CLI aliases, SSH keys and deployment pipelines that do not depend on anyone opening the dashboard.</li>
</ul>



<p class="wp-block-paragraph">If something specific is going wrong, send the actual output. A dry-run report, a <code>wp cli info</code> dump, a <code>wp cron event list</code> table, and I can usually tell you where the problem is before we talk about scope.</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="https://www.upwork.com/freelancers/~01f15a912ad84a6620" target="_blank" rel="noreferrer noopener">Work with me on Upwork</a></div>
</div>
<p>The post <a href="https://john-nessime.com/blog/technical-guides/wp-cli-commands-that-save-hours/">WP-CLI Commands That Save Hours (And the One That Bites Back)</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://john-nessime.com/blog/technical-guides/wp-cli-commands-that-save-hours/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Managed WordPress Hosting vs VPS: Who Owns the Failure?</title>
		<link>https://john-nessime.com/blog/wordpress/managed-wordpress-hosting-vs-vps/</link>
					<comments>https://john-nessime.com/blog/wordpress/managed-wordpress-hosting-vs-vps/#respond</comments>
		
		<dc:creator><![CDATA[John Nessime]]></dc:creator>
		<pubDate>Sat, 08 Aug 2026 13:00:00 +0000</pubDate>
				<category><![CDATA[Hosting & Infrastructure]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Cloudflare]]></category>
		<category><![CDATA[Cost Optimization]]></category>
		<category><![CDATA[Managed Hosting]]></category>
		<category><![CDATA[Object Cache]]></category>
		<category><![CDATA[Redis]]></category>
		<category><![CDATA[Restore Testing]]></category>
		<category><![CDATA[Self Hosting]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Vendor Lock-In]]></category>
		<category><![CDATA[VPS]]></category>
		<category><![CDATA[Website Migration]]></category>
		<category><![CDATA[WordPress Backup]]></category>
		<category><![CDATA[WordPress Hosting]]></category>
		<category><![CDATA[WP-CLI]]></category>
		<guid isPermaLink="false">https://john-nessime.com/blog/?p=165</guid>

					<description><![CDATA[<p>Managed WordPress hosting and a self-managed VPS can both serve a fast site. They differ on which failures land on you. A practical comparison covering visit metering, disallowed plugin policies, silent backup failure, patching debt, and a cost model that survives contact with reality.</p>
<p>The post <a href="https://john-nessime.com/blog/wordpress/managed-wordpress-hosting-vs-vps/">Managed WordPress Hosting vs VPS: Who Owns the Failure?</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">A colleague pinged me about a site where the caching plugin had stopped existing. Not deactivated. Gone from the plugin list, gone from the filesystem. Nobody on the team had touched it.</p>



<p class="wp-block-paragraph">The host had removed it. It was on their disallowed list, a routine scan found it, and the platform did exactly what its documentation said it would do. Everyone had agreed to that when they signed up. Nobody had read it.</p>



<p class="wp-block-paragraph">That incident is the whole managed WordPress hosting vs VPS argument in miniature, and it has almost nothing to do with page speed. Both models can serve a fast WordPress site. They differ on which failures land on you, which land on someone else, and which ones stay invisible until the worst possible moment.</p>



<p class="wp-block-paragraph">This post compares the two the way I&#8217;d compare them for a client: an honest profile of each, the costs that never appear on the invoice, a procedure for modelling the real number, and the decision rules I actually use. No benchmark charts, because your theme and your plugin count will dominate anything the host does.</p>



<h2 class="wp-block-heading">The real question: who owns the failure at 2am</h2>



<p class="wp-block-paragraph">Most comparisons frame this as control versus convenience. True, but useless, because it doesn&#8217;t tell you what to buy. The framing that predicts regret is: when something breaks, whose problem is it, and how fast can they fix it?</p>



<p class="wp-block-paragraph">Split the failure surface into layers and the answer gets concrete:</p>



<ul class="wp-block-list">
<li><strong>Hardware and hypervisor.</strong> Theirs in both models. Your recovery time is still yours.</li>

<li><strong>OS, web server, PHP, database.</strong> Theirs on managed hosting, yours on an unmanaged VPS. This is the big split.</li>

<li><strong>Backups and restores.</strong> Theirs on managed, and tested, because their business depends on it. Yours on a VPS, and almost nobody tests them.</li>

<li><strong>Core, themes, plugins.</strong> Mostly yours either way. Some hosts auto-update, but the compatibility fallout is still yours.</li>

<li><strong>Your code and your content.</strong> Always yours. No host takes this on.</li>
</ul>



<p class="wp-block-paragraph">The bottom two rows never move. A managed platform will not make your bloated page builder fast, and it will not stop a vulnerable plugin from being exploited. It moves the middle three rows off your plate and charges you in money and in flexibility.</p>



<h2 class="wp-block-heading">Managed WordPress hosting, assessed honestly</h2>



<h3 class="wp-block-heading">Where it genuinely wins</h3>



<p class="wp-block-paragraph">The strongest argument isn&#8217;t performance. It&#8217;s that the boring, high-consequence work gets done by people whose job it is, on a schedule, whether or not you remember.</p>



<ul class="wp-block-list">
<li><strong>Restores that work.</strong> One-click recovery from a backup the platform verifies. That&#8217;s the difference between a bad hour and a bad week.</li>

<li><strong>Server-level page caching, already tuned.</strong> WP Engine, Kinsta, Pressable and Flywheel run full-page caching in front of PHP. It&#8217;s why they ban plugins that try to do the same thing badly.</li>

<li><strong>Staging that isn&#8217;t a science project.</strong> Clone, test, push back. On a VPS that&#8217;s yours to build, and a half-built staging setup is worse than none.</li>

<li><strong>Support that knows WordPress.</strong> A generic VPS provider&#8217;s ticket ends at &#8220;the server is up&#8221;. A WordPress host will look at your slow query log.</li>

<li><strong>Edge protection before PHP loads.</strong> WAF and bot filtering at the infrastructure layer, the only layer where they meaningfully help. A plugin firewall runs after the request has already cost you a PHP worker.</li>
</ul>



<p class="wp-block-paragraph">If nobody on your team wants to own a Linux box, that list is decisive. The rest of this section is about what you&#8217;re trading away.</p>



<h3 class="wp-block-heading">Visit metering is a billing model, not a traffic report</h3>



<p class="wp-block-paragraph">This is the cost that bites hardest, because it doesn&#8217;t look like a technical constraint until the invoice arrives.</p>



<p class="wp-block-paragraph">Most managed plans meter &#8220;visits&#8221; rather than bandwidth or CPU, and the definition is narrower than it sounds. <a href="https://wpengine.com/support/count-visits/" target="_blank" rel="noreferrer noopener">WP Engine defines a billable visit</a> as one unique IP address logged per day, with static assets like images, CSS and JavaScript excluded, and known and suspected bot user agents filtered out. <a href="https://kinsta.com/docs/billing/wordpress-hosting-plans/overages/" target="_blank" rel="noreferrer noopener">Kinsta counts</a> the sum of unique IPs seen within each 24-hour period across the plan, and also sells bandwidth-metered plans as an alternative. Flywheel filters IPs belonging to known bots, spammers and attackers before counting.</p>



<p class="wp-block-paragraph">Three consequences follow, and they&#8217;re the ones people miss:</p>



<ul class="wp-block-list">
<li><strong>Your host&#8217;s number will not match Google Analytics.</strong> Analytics counts sessions from browsers that ran its JavaScript. Your host counts IPs that hit the server. Arguing about the gap is wasted effort.</li>

<li><strong>Bot filtering is best-effort.</strong> Hosts filter what they can identify. A scraper with a browser-shaped user agent and rotating IPs looks, to the meter, like a crowd of new visitors.</li>

<li><strong>Overages are charged per block of excess visits.</strong> Rates change, so check the current figure rather than trusting any article, including this one. What matters is the shape: a viral post or a bad crawl month produces a bill you didn&#8217;t budget for.</li>
</ul>



<p class="wp-block-paragraph">A VPS has the opposite failure mode. Bad traffic costs you CPU and RAM, not money, right up until it exhausts them and the site falls over. One model converts load into a bill, the other converts it into an outage. Pick the one you&#8217;d rather explain to whoever owns the site.</p>



<h3 class="wp-block-heading">The plugin policy is a real constraint</h3>



<p class="wp-block-paragraph">Managed hosts publish disallowed plugin lists and they enforce them. WP Engine documents that disallowed plugins are found by periodic scans of the site&#8217;s filesystem, the owner is notified, and the plugin is removed. That&#8217;s not a threat, it&#8217;s the operating model, and it&#8217;s why the incident I opened with was nobody&#8217;s fault.</p>



<p class="wp-block-paragraph">The banned categories are consistent across vendors, and the reasoning holds up in each case:</p>



<ul class="wp-block-list">
<li><strong>Caching plugins.</strong> They fight the platform&#8217;s own page cache and produce stale output that support then has to debug.</li>

<li><strong>Backup plugins.</strong> They write large archives onto the same disk the site runs on, which is a useless backup if the disk is what fails.</li>

<li><strong>Database optimisation plugins.</strong> Long-running write-heavy queries on shared infrastructure affect neighbours.</li>

<li><strong>Some security plugins, or specific features within them.</strong> Filesystem-based rule storage and high-volume traffic logging are the usual triggers. Policies vary a lot here.</li>

<li><strong>Plugins that send mail directly.</strong> Platforms push you to a transactional provider instead, for deliverability reasons that are genuinely in your interest.</li>
</ul>



<p class="wp-block-paragraph">None of that is unreasonable. The problem is when a plugin your business depends on lands in one of those buckets, or when a host adds something to the list later. Before migrating, read the current disallowed list for that specific host and diff it against your live active plugins. Ten minutes, and it&#8217;s the highest-value thing you can do in a hosting evaluation.</p>



<h3 class="wp-block-heading">You get one shape of application</h3>



<p class="wp-block-paragraph">A managed WordPress platform runs WordPress. If your project also needs a Node service, a Python worker, a queue, or a self-hosted analytics instance, that&#8217;s a second bill somewhere else. On a VPS those things are free in cash terms because you already own the machine. They cost you memory and attention instead. Whether that&#8217;s a good trade depends on whether you were going to need them anyway.</p>



<h2 class="wp-block-heading">Running WordPress on your own VPS, assessed honestly</h2>



<h3 class="wp-block-heading">Where it genuinely wins</h3>



<ul class="wp-block-list">
<li><strong>Resources per unit of money.</strong> Hetzner, InterServer, DigitalOcean and Vultr will sell you more CPU and RAM than an entry managed plan. Whether you can use it is a separate question.</li>

<li><strong>Many sites, one bill.</strong> This is where the economics genuinely flip. Ten small sites on one adequate VPS is one server to patch. Ten managed plans is ten invoices.</li>

<li><strong>No metering surprises.</strong> Traffic spikes hit your load average, not your credit card.</li>

<li><strong>You choose the stack.</strong> Nginx or Apache, PHP-FPM pool sizing, Redis for the object cache, your own MariaDB tuning and firewall rules. If the platform&#8217;s opinions were what limited you, this is the fix.</li>

<li><strong>No lock-in.</strong> A tarball and a database dump move anywhere. Platform-specific caching behaviour, redirect rules and deployment workflows do not.</li>
</ul>



<h3 class="wp-block-heading">The failure that stays invisible: the backup you never restored</h3>



<p class="wp-block-paragraph">Here&#8217;s the one that actually ends projects. Backups on a self-managed VPS fail silently. The cron entry runs, the exit code goes nowhere, the destination bucket quietly rejects writes after a credential rotation, and nothing tells you. You find out the day you need it, which is also the day you have no other option.</p>



<p class="wp-block-paragraph">The fix isn&#8217;t a better tool. Restic and BorgBackup are both excellent and neither will save you. The fix is a restore drill on a schedule, into a scratch directory, where you verify the data is actually there.</p>



<pre class="wp-block-code"><code># Restore the newest snapshot into a scratch path, never over the live site
restic -r /srv/backups/wp restore latest --target /tmp/restore-drill

# Confirm the dump is real and not a zero-byte file or a truncated
# write from a run that died halfway through
ls -lh /tmp/restore-drill/db/
head -n 20 /tmp/restore-drill/db/site.sql

# Load into a throwaway database and count what came back.
# If wp_posts is empty, your backups have been failing for weeks.
mysql -u drill -p drill_db &lt; /tmp/restore-drill/db/site.sql
mysql -u drill -p -e "SELECT COUNT(*) FROM drill_db.wp_posts;"</code></pre>



<p class="wp-block-paragraph">Adjust the repository path and database names to your own. The shape is the point: restore somewhere harmless, then check a row count that would be non-zero on a healthy site. A backup you haven&#8217;t restored is a hypothesis, not a backup. Uptime checks from something like UptimeRobot tell you the site is down; they tell you nothing about whether you can get it back.</p>



<h3 class="wp-block-heading">Patching debt compounds quietly</h3>



<p class="wp-block-paragraph">The second invisible cost is the gap between &#8220;updates are available&#8221; and &#8220;updates are applied and the affected services have actually restarted&#8221;. Upgrading a package without restarting the process leaves the old, vulnerable code resident in memory. That&#8217;s why security scanners and package managers disagree so often.</p>



<pre class="wp-block-code"><code># RHEL family (AlmaLinux, Rocky, CentOS Stream)
# What security updates are outstanding?
sudo dnf updateinfo list security

# After applying them: does anything still need a restart?
# Exit 0 means no reboot required, exit 1 means reboot required.
sudo dnf needs-restarting -r

# Debian and Ubuntu: what would unattended-upgrades actually do?
sudo unattended-upgrade --dry-run --debug</code></pre>



<p class="wp-block-paragraph">Run those on any VPS you inherited from someone else. The output is usually educational. Then there&#8217;s the WordPress layer, which stays yours regardless of hosting model:</p>



<pre class="wp-block-code"><code># Do the core files match the official checksums for this version?
# A mismatch means a modified core file or an active compromise.
wp core verify-checksums

# How many plugins are behind?
wp plugin list --update=available --format=count

# Which tables are eating the disk? Usually wp_options, wp_postmeta,
# or a logging plugin nobody remembers installing.
wp db size --tables --format=table</code></pre>



<h2 class="wp-block-heading">Model the cost before you argue about it</h2>



<p class="wp-block-paragraph">Sticker price comparisons are how people talk themselves into the wrong answer in both directions. This procedure produces a number you can defend.</p>



<ol class="wp-block-list">
<li><strong>Count your sites.</strong> One tilts toward managed. Five or more tilts toward a VPS, because admin time is close to fixed and plan fees are per-site.</li>

<li><strong>Estimate your metered visit count from your own logs.</strong> If you&#8217;re already on a server you control, you can approximate what a metered host would bill you before signing anything.</li>

<li><strong>Price the VPS honestly.</strong> Instance plus block storage plus offsite backup destination plus any control panel licence. The advertised instance price is rarely the whole line.</li>

<li><strong>Put a rate on your own hours.</strong> Whatever you&#8217;d bill a client, or pay someone else. Zero is not an honest number.</li>

<li><strong>Add the one-off build.</strong> Standing up a hardened WordPress VPS with TLS, firewall, object cache, tested backups and log rotation is a solid chunk of focused work the first time. Amortise it over twelve months.</li>

<li><strong>Add your recovery cost.</strong> Hours to rebuild from scratch, times your rate, times how often you honestly think it&#8217;ll happen. This term is what makes managed hosting look cheap for a single revenue-generating site.</li>
</ol>



<p class="wp-block-paragraph">Step two is worth doing properly, because it&#8217;s the number nobody has. On Nginx with the standard combined log format, this gets you close:</p>



<pre class="wp-block-code"><code># Unique client IPs in the log. A rough upper bound on metered "visits".
awk '{print $1}' /var/log/nginx/access.log | sort -u | wc -l

# Closer to how hosts count: ignore static assets, since most platforms
# exclude images, CSS and JS from billable visits.
awk '$7 !~ /.(css|js|png|jpg|jpeg|gif|svg|webp|woff2?|ico)$/ {print $1}' 
  /var/log/nginx/access.log | sort -u | wc -l

# What is actually hitting you? User agents by request count.
# If the top entries are crawlers, that is your overage risk.
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20</code></pre>



<p class="wp-block-paragraph">Field positions assume the combined log format; adjust the column numbers if you&#8217;ve customised <code>log_format</code>. The third command is the interesting one. If crawlers dominate your traffic, visit-metered hosting will charge you for whatever the host&#8217;s filtering misses, and that&#8217;s a risk you can quantify before signing up rather than after.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The middle ground worth looking at first</h2>



<p class="wp-block-paragraph">This gets presented as two options. There are four, and the middle two get skipped far too often.</p>



<ul class="wp-block-list">
<li><strong>Managed VPS.</strong> InterServer, Liquid Web and others sell VPS plans where the provider handles OS patching, firewall and backups while you keep root. Read the scope: &#8220;managed&#8221; often stops at the operating system and leaves the WordPress stack to you.</li>

<li><strong>Control panel on your own VPS.</strong> DirectAdmin, cPanel or CyberPanel gives you WordPress-aware tooling, staging and one-click TLS on infrastructure you still own. You pay a licence and give up some configuration purity.</li>

<li><strong>Server management platforms.</strong> Cloudways, RunCloud, GridPane and SpinupWP provision and manage a stack on a VPS you rent from a provider of your choice. Managed-style workflows without the per-visit meter.</li>

<li><strong>A CDN in front of anything.</strong> Putting Cloudflare or a similar edge ahead of a modest VPS absorbs a large share of the traffic that would otherwise push you onto a bigger plan. Cheapest performance win available to either model, and frequently the actual answer to &#8220;we need better hosting&#8221;.</li>
</ul>



<p class="wp-block-paragraph">If you&#8217;re leaning toward a VPS mainly because managed pricing looks steep, look at options two and three before committing to a bare Linux box.</p>



<h2 class="wp-block-heading">How I&#8217;d decide between managed WordPress hosting vs VPS</h2>



<p class="wp-block-paragraph">These are the rules I apply, in order. The first match usually settles it.</p>



<ul class="wp-block-list">
<li><strong>Nobody on the team can or wants to run Linux.</strong> Managed, and it isn&#8217;t close. An unpatched VPS is worse than the most restrictive managed plan.</li>

<li><strong>One site, and it generates revenue.</strong> Managed. The recovery term dominates everything else in the cost model.</li>

<li><strong>Five or more sites and someone competent to run them.</strong> VPS, or a management platform on top of one.</li>

<li><strong>You need services WordPress isn&#8217;t.</strong> VPS. Don&#8217;t pay for two platforms to avoid learning one.</li>

<li><strong>A plugin you can&#8217;t remove is on the host&#8217;s disallowed list.</strong> VPS, or a different managed host. Do not migrate hoping for an exception.</li>

<li><strong>Traffic is spiky and crawler-heavy.</strong> Lean VPS, or pick a bandwidth-metered plan over a visit-metered one. Metering punishes exactly this traffic shape.</li>

<li><strong>You&#8217;re mostly annoyed at the current bill.</strong> Neither, yet. Put a CDN in front, cut the plugin count, fix the object cache. Hosting is often not the bottleneck.</li>
</ul>



<h2 class="wp-block-heading">Arguments that don&#8217;t survive contact</h2>



<ul class="wp-block-list">
<li><strong>&#8220;A VPS is faster because you get dedicated resources.&#8221;</strong> Only if it&#8217;s configured well. A default LEMP install with no object cache and an untuned PHP-FPM pool loses to a managed platform&#8217;s edge cache every time.</li>

<li><strong>&#8220;Managed hosting handles security, so I&#8217;m covered.&#8221;</strong> It handles infrastructure security. The most common route into a WordPress site is a vulnerable plugin, and that&#8217;s yours in both models.</li>

<li><strong>&#8220;I&#8217;ll just move if I outgrow it.&#8221;</strong> Migration cost is real and grows with the site. Redirect rules, caching behaviour, deployment workflow and email configuration all need rebuilding.</li>

<li><strong>&#8220;The VPS is only a few dollars a month.&#8221;</strong> The instance is. Offsite backup storage, monitoring and your own hours are not, and they&#8217;re most of the number.</li>

<li><strong>&#8220;Managed hosts back everything up, so I don&#8217;t need my own backups.&#8221;</strong> Retention windows are finite and account access can be lost. Keep an independent copy the host doesn&#8217;t control. This applies to both models.</li>
</ul>



<h2 class="wp-block-heading">Frequently asked questions</h2>



<h3 class="wp-block-heading">Is a VPS actually cheaper than managed WordPress hosting?</h3>



<p class="wp-block-paragraph">For one site, usually not once you price your own time honestly. For several sites, usually yes, and the gap widens with each site you add. The crossover sits somewhere around three to five sites for most people, depending on what your hours are worth and how much the sites change.</p>



<h3 class="wp-block-heading">Why does my managed host report more visitors than Google Analytics?</h3>



<p class="wp-block-paragraph">They measure different things. Analytics counts browser sessions that executed its JavaScript, so it misses anything blocking scripts and misses non-browser clients entirely. Your host counts requests reaching the server, deduplicated by IP per day. Bot filtering closes some of the gap but never all of it. The two numbers are not supposed to match.</p>



<h3 class="wp-block-heading">Can I run other applications alongside WordPress on managed hosting?</h3>



<p class="wp-block-paragraph">Generally no. Managed WordPress platforms run WordPress and nothing else. A background worker, a separate API, a queue or a self-hosted analytics instance needs a VPS or a second platform. Factor that second bill into the comparison.</p>



<h3 class="wp-block-heading">What happens if I install a disallowed plugin?</h3>



<p class="wp-block-paragraph">It depends on the host, but the documented pattern at WP Engine is that periodic filesystem scans detect it, you get notified, and the plugin is removed. Check the specific host&#8217;s current policy and enforcement mechanism before migrating, and check it against your live plugin list rather than what you assume is installed.</p>



<h3 class="wp-block-heading">Do I still need a caching plugin on a VPS?</h3>



<p class="wp-block-paragraph">You need caching. Whether it&#8217;s a plugin is a design choice. The strongest setup is full-page caching at the web server or CDN layer plus a persistent object cache in Redis or Memcached, which handles the repeated database queries page caching can&#8217;t touch. A page cache alone leaves logged-in traffic and admin requests hitting the database on every load.</p>



<h3 class="wp-block-heading">Is managed VPS hosting a real middle ground or just marketing?</h3>



<p class="wp-block-paragraph">It&#8217;s real, but the scope varies enormously and the word isn&#8217;t standardised. Ask specifically: who applies OS security patches, who restarts services afterwards, who owns backups and where they live, whether restores are tested, and whether the WordPress stack is in scope or the coverage stops at the operating system. Get the answers in writing before comparing prices.</p>



<h3 class="wp-block-heading">How hard is migrating from managed hosting to a VPS?</h3>



<p class="wp-block-paragraph">Moving files and the database is the easy part. The work is everything the platform did invisibly: redirect rules living in the host&#8217;s dashboard, cache purging behaviour, transactional email, TLS renewal, and any deployment workflow tied to the platform. Plan a parallel run with low DNS TTLs rather than a cutover, and keep the old plan alive until the new one has survived a full traffic cycle.</p>



<h2 class="wp-block-heading">The one thing worth remembering</h2>



<p class="wp-block-paragraph">Managed WordPress hosting vs VPS isn&#8217;t a performance question, and it isn&#8217;t really a price question either. It&#8217;s a question about which failures you&#8217;re equipped to own.</p>



<p class="wp-block-paragraph">Managed hosting converts operational risk into a predictable bill and a set of constraints you have to live inside. A VPS converts that bill into flexibility plus a standing obligation to do the boring work: patch, restart, and prove your restores actually restore. Both are defensible. What isn&#8217;t defensible is buying a VPS because it looked cheap and then skipping the work, which is the most common failure in this whole category and the one that ends with a rebuild from a backup nobody ever tested.</p>



<p class="wp-block-paragraph">Run the restore drill. Whatever you choose.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Need a second opinion on your hosting decision?</h2>



<p class="wp-block-paragraph">Most of the hosting work I get asked for is one of these. If it looks like your situation, I can help:</p>



<ul class="wp-block-list">
<li><strong>Cost modelling before you commit.</strong> Working out from your own access logs what a visit-metered plan would actually bill you, against a realistically priced VPS including backup storage and hours.</li>

<li><strong>Migration in either direction.</strong> Managed to VPS or VPS to managed, planned as a parallel run with DNS TTL staging so there&#8217;s no blind cutover.</li>

<li><strong>Building the VPS properly the first time.</strong> Nginx or Apache with PHP-FPM sized to the actual RAM, Redis object cache, TLS with automated renewal, firewall and Fail2ban, log rotation that doesn&#8217;t fill the disk.</li>

<li><strong>Backups you&#8217;ve actually restored.</strong> Offsite destination, retention policy, and a scheduled restore drill that fails loudly instead of silently.</li>

<li><strong>Plugin policy audits.</strong> Checking your live plugin list against a specific host&#8217;s disallowed list before migration, and finding replacements for anything that fails.</li>

<li><strong>Monitoring that answers the right question.</strong> Grafana and Prometheus dashboards covering PHP-FPM saturation, database load and cache hit ratio, not just whether the site returns 200.</li>
</ul>



<p class="wp-block-paragraph">Send me something concrete and I&#8217;ll tell you what I see: an access log sample, your current plan and traffic numbers, your active plugin list, or the output of the commands above. That&#8217;s usually enough for a straight answer before either of us talks about scope.</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="https://www.upwork.com/freelancers/~01f15a912ad84a6620" target="_blank" rel="noreferrer noopener">Work with me on Upwork</a></div>
</div>
<p>The post <a href="https://john-nessime.com/blog/wordpress/managed-wordpress-hosting-vs-vps/">Managed WordPress Hosting vs VPS: Who Owns the Failure?</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://john-nessime.com/blog/wordpress/managed-wordpress-hosting-vs-vps/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The OOM Killer Took MySQL: Redis Object Caching for WordPress</title>
		<link>https://john-nessime.com/blog/technical-guides/redis-object-cache-wordpress/</link>
					<comments>https://john-nessime.com/blog/technical-guides/redis-object-cache-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[John Nessime]]></dc:creator>
		<pubDate>Tue, 04 Aug 2026 03:39:00 +0000</pubDate>
				<category><![CDATA[Technical Guides]]></category>
		<category><![CDATA[Web Performance]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Object Cache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Redis]]></category>
		<category><![CDATA[Self Hosting]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Website Performance]]></category>
		<category><![CDATA[Website Speed]]></category>
		<category><![CDATA[WordPress Hosting]]></category>
		<category><![CDATA[WP-CLI]]></category>
		<guid isPermaLink="false">https://john-nessime.com/blog/?p=114</guid>

					<description><![CDATA[<p>MySQL was gone in the morning because the kernel picked it to reclaim memory from Redis. Redis ships configured as a durable datastore, and you are using it as a cache. Setup takes ten minutes; the gotchas are memory limits, shared namespaces and the one enormous key nobody mentions.</p>
<p>The post <a href="https://john-nessime.com/blog/technical-guides/redis-object-cache-wordpress/">The OOM Killer Took MySQL: Redis Object Caching for WordPress</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">The site went down overnight. MySQL was not running. The logs showed the kernel&#8217;s OOM killer had chosen it, which is what the kernel does when it needs memory and something has to go.</p>



<p class="wp-block-paragraph">The thing that needed the memory was Redis, installed three weeks earlier to speed up the admin, running with the configuration it shipped with. Redis defaults to no memory limit and a policy of never evicting anything. Left alone it will happily grow until the machine runs out, and then the kernel picks a victim, and it will not necessarily pick Redis.</p>



<p class="wp-block-paragraph">That is the framing for everything below. <strong>Redis object caching for WordPress</strong> is genuinely one of the highest-value changes you can make to a busy site, and Redis out of the box is configured as a durable datastore, not a cache. You are storing data you can regenerate at any time. The defaults assume the opposite.</p>



<p class="wp-block-paragraph">Setup takes ten minutes. The gotchas are the post.</p>



<h2 class="wp-block-heading">What it does, and what it doesn&#8217;t</h2>



<p class="wp-block-paragraph">WordPress has an object cache built in, and by default it lasts exactly one request. Every page load fetches the same options, terms, post meta and user meta from MySQL, uses them, and throws them away. A persistent object cache keeps that data between requests, so the second visitor does not repeat the first visitor&#8217;s queries.</p>



<p class="wp-block-paragraph">Two expectations worth setting before you install anything.</p>



<p class="wp-block-paragraph"><strong>It is not a page cache.</strong> Page caching serves a finished HTML file and never runs PHP. Object caching runs the whole application and makes the database part faster. They live in different drop-ins, do different jobs, and coexist happily.</p>



<p class="wp-block-paragraph"><strong>Its biggest effect is where page caching does not reach.</strong> Logged-in requests, wp-admin, WooCommerce carts and checkouts, REST API calls. If your front end is already cached and fast while the dashboard crawls, an object cache is aimed exactly at your problem.</p>



<h2 class="wp-block-heading">Setup</h2>



<ol class="wp-block-list">
<li><strong>Install Redis</strong> from your distribution&#8217;s packages, and bind it to localhost unless something remote genuinely needs it.</li>
<li><strong>Install a PHP Redis client.</strong> PhpRedis (the PECL extension) is faster than the pure-PHP Predis and is what you want on a real server. Relay is a newer option worth knowing about if you are pushing volume.</li>
<li><strong>Install the Redis Object Cache plugin</strong>, then add the constants below to <code>wp-config.php</code> <em>before</em> enabling the drop-in.</li>
<li><strong>Enable it</strong>, which copies <code>object-cache.php</code> into <code>wp-content/</code>. That file, not the plugin, is what WordPress actually loads.</li>
<li><strong>Verify it end to end</strong>, which is step five for a reason.</li>
</ol>



<pre class="wp-block-code"><code>// wp-config.php, above the "That's all, stop editing" line.

define( 'WP_REDIS_HOST',     '127.0.0.1' );
define( 'WP_REDIS_PORT',     6379 );

// Two different protections, and you want both. The database
// number scopes flushes; the prefix prevents key collisions.
define( 'WP_REDIS_DATABASE', 1 );
define( 'WP_REDIS_PREFIX',   'acme-prod:' );

// Ceiling for keys written with no expiry, so nothing lives forever.
define( 'WP_REDIS_MAXTTL',   86400 );</code></pre>



<p class="wp-block-paragraph">One note if you are following an older tutorial: the prefix constant used to be <code>WP_CACHE_KEY_SALT</code> and was renamed to <code>WP_REDIS_PREFIX</code> in version 2.0 of the plugin, to stop it being confused with a core constant of the same name. The old name is still read for compatibility, but if a guide is still using it, that guide predates a major version and its other advice may too.</p>



<p class="wp-block-paragraph">Then prove it works rather than trusting a green indicator on a settings page:</p>



<pre class="wp-block-code"><code># The plugin's own view.
wp redis status

# Write through WordPress, read it back through WordPress.
wp eval 'wp_cache_set("probe","ok","test",60); echo wp_cache_get("probe","test");'

# Then confirm the key landed in the database and prefix you expect.
redis-cli -n 1 --scan --pattern 'acme-prod:*' | head</code></pre>



<p class="wp-block-paragraph">Site Health under Tools will also tell you whether WordPress considers a persistent object cache to be in use. That is the check to trust, because it reflects what core sees rather than what the plugin believes.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Gotcha 1: the defaults are a datastore&#8217;s defaults</h2>



<p class="wp-block-paragraph">The one from the opening paragraph, and the only one on this list that can take a server down.</p>



<pre class="wp-block-code"><code># /etc/redis/redis.conf

# Without a limit, Redis grows until the machine runs out and the
# kernel kills something. It will not necessarily kill Redis.
maxmemory 512mb

# The default policy is to refuse writes rather than evict. Correct
# for a datastore, wrong for a cache: you want the least recently
# used keys dropped, silently, forever.
maxmemory-policy allkeys-lru

# Cache contents are regenerable by definition. Persisting them buys
# nothing and costs you fork latency on save and slower restarts.
save ""
appendonly no</code></pre>



<p class="wp-block-paragraph">Size <code>maxmemory</code> against what the machine can spare after MySQL and PHP-FPM have what they need, not against what is currently free. Free memory on a healthy Linux box is mostly page cache, and it is doing useful work.</p>



<p class="wp-block-paragraph">The honest trade-off with <code>allkeys-lru</code>: under memory pressure Redis will evict things you would rather it kept, and cache misses go up. That is the correct failure mode. The alternative is write errors surfacing inside WordPress, or an outage.</p>



<p class="wp-block-paragraph">If you are on managed hosting, do not change any of this. Ask them what they have set, because they may have tuned it and may not appreciate you undoing it.</p>



<h2 class="wp-block-heading">Gotcha 2: one Redis, several sites</h2>



<p class="wp-block-paragraph">Redis is a single key-value store. Two WordPress installs pointed at it with default settings both write <code>post_123</code> to the same key and read each other&#8217;s data. On a server hosting several sites that is a correctness bug. Where it gets genuinely nasty is staging.</p>



<p class="wp-block-paragraph">Staging is usually a clone of production, which means it inherits production&#8217;s <code>wp-config.php</code>, which means it inherits production&#8217;s Redis settings. Now both environments share a namespace, and a developer clearing the cache on staging clears production&#8217;s, or worse, staging serves production&#8217;s cached objects.</p>



<p class="wp-block-paragraph">The two constants guard against different things and you want both:</p>



<ul class="wp-block-list">
<li><strong><code>WP_REDIS_DATABASE</code></strong> selects a logical database, of which Redis provides sixteen by default. This scopes flushes, so one site clearing its cache does not clear another&#8217;s.</li>
<li><strong><code>WP_REDIS_PREFIX</code></strong> namespaces every key. This prevents collisions if two installs ever land in the same database, which is what happens the day somebody copies a config file.</li>
</ul>



<p class="wp-block-paragraph">Make the prefix readable and environment-specific: <code>acme-prod:</code> and <code>acme-staging:</code>, not a random string. It is a namespace, not a secret, and you will want to read it in <code>redis-cli</code> at some point.</p>



<p class="wp-block-paragraph">If you use Relay as the client, a dedicated database <em>and</em> a unique prefix per install is a requirement rather than a suggestion.</p>



<h2 class="wp-block-heading">Gotcha 3: some things are never cached, and one thing is enormous</h2>



<p class="wp-block-paragraph">Not every cache group is persistent. WordPress marks some as non-persistent, and plugins can mark their own, so those groups keep behaving exactly as they did before you installed anything. If you expected a specific thing to get faster and it did not, this is a likely reason and it is not a misconfiguration.</p>



<p class="wp-block-paragraph">The more interesting one is <code>alloptions</code>. WordPress stores all autoloaded options as a <em>single</em> cache entry. On a site with a bloated options table, that is one very large key, fetched on every request, and invalidated whenever any autoloaded option is written. Under concurrency that produces a lot of simultaneous re-priming of the same large value.</p>



<p class="wp-block-paragraph">Which means an object cache does not excuse a bloated options table; it changes where the cost lands. Check what your keys actually look like:</p>



<pre class="wp-block-code"><code># Reports the largest key per type. If one key dwarfs everything
# else, it is probably alloptions and your options table needs work.
redis-cli -n 1 --bigkeys</code></pre>



<h2 class="wp-block-heading">Gotcha 4: flushing is not free</h2>



<p class="wp-block-paragraph">Clearing the object cache on a busy site means every subsequent request rebuilds what it needs from MySQL simultaneously. On a quiet site nobody notices. On a busy one you get a load spike at exactly the moment you were trying to fix something.</p>



<p class="wp-block-paragraph">Know what your flush actually does. Some implementations issue a Redis-wide flush; others delete only keys matching your prefix. Those are very different operations when the instance is shared, and finding out during an incident is a bad time.</p>



<p class="wp-block-paragraph">Also worth deciding deliberately: whether deploys flush the cache. Stale cached objects after a plugin update cause genuinely confusing bugs, so a flush in the deploy script is often right. Just do it knowing it costs a load spike, and put it at the start of a quiet window rather than at five o&#8217;clock on a Friday.</p>



<h2 class="wp-block-heading">Troubleshooting</h2>



<p class="wp-block-paragraph"><strong>&#8220;Drop-in: invalid&#8221; or &#8220;not connected&#8221;.</strong> Usually the PHP extension is missing, or PHP cannot reach Redis on the host and port you gave it. Check with <code>php -m | grep redis</code> and <code>redis-cli ping</code> from the same machine PHP runs on, which is not always the machine you are logged into.</p>



<p class="wp-block-paragraph"><strong>Everything looks connected but nothing is cached.</strong> Something replaced <code>object-cache.php</code>. Optimisation plugins install their own drop-in, and only one can win. Check the file&#8217;s contents, not just that it exists.</p>



<p class="wp-block-paragraph"><strong>The site got slower.</strong> Latency to Redis. A remote instance across a network adds a round trip to every cache operation, and there are a lot of them per request. Localhost or a Unix socket beats a fast network every time.</p>



<p class="wp-block-paragraph"><strong>Stale data after an update.</strong> Flush once, then work out which plugin is caching something it should be invalidating. Do not put a flush on every request to make the symptom go away.</p>



<p class="wp-block-paragraph"><strong>Memory keeps climbing.</strong> Either no <code>maxmemory</code>, or keys written with no expiry and no <code>WP_REDIS_MAXTTL</code> ceiling. Check <code>INFO memory</code> and the eviction counters.</p>



<p class="wp-block-paragraph"><strong>Staging and production interfering.</strong> They are sharing a database number, a prefix, or both. Fix the config on staging as part of your restore script so it cannot recur.</p>



<h2 class="wp-block-heading">Common mistakes</h2>



<ul class="wp-block-list">
<li>Running Redis with default memory settings on a shared box.</li>
<li>Leaving persistence enabled for a pure cache workload.</li>
<li>No prefix and no database number, so sites read each other&#8217;s objects.</li>
<li>Cloning production to staging without changing the Redis settings.</li>
<li>Trusting the plugin&#8217;s status page instead of Site Health and an actual read-back.</li>
<li>Expecting it to speed up an already page-cached front end.</li>
<li>Installing it and ignoring an options table full of autoloaded junk.</li>
<li>Predis on a production site when PhpRedis is available.</li>
<li>Putting Redis on a different host and adding a network hop to every cache call.</li>
<li>Flushing the cache during peak traffic to fix a display bug.</li>
<li>Two plugins competing for the <code>object-cache.php</code> drop-in.</li>
</ul>



<h2 class="wp-block-heading">Best practices</h2>



<ul class="wp-block-list">
<li>Set <code>maxmemory</code> and <code>allkeys-lru</code> before you point any site at it.</li>
<li>Disable persistence unless Redis is also doing a job that needs it.</li>
<li>Unique database number and readable prefix per install and per environment.</li>
<li>Bind to localhost, or require a password and TLS if it must be remote.</li>
<li>PhpRedis over Predis, and Redis on the same host as PHP where you can.</li>
<li>A <code>WP_REDIS_MAXTTL</code> ceiling so nothing lives forever by accident.</li>
<li>Verify with Site Health plus a write-and-read test, not a status indicator.</li>
<li>Clean up autoloaded options rather than caching the mess.</li>
<li>Monitor memory used, evicted keys and hit rate; a collapsing hit rate is an early warning.</li>
<li>Make staging&#8217;s Redis config part of the restore script, not something to remember.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">FAQ</h2>



<h3 class="wp-block-heading">Do I need Redis if I already have a caching plugin?</h3>



<p class="wp-block-paragraph">Probably, because they solve different problems. Page caching handles anonymous visitors; object caching handles everything that cannot be page cached, which is the admin, logged-in users and anything transactional. Run both.</p>



<h3 class="wp-block-heading">Redis or Memcached?</h3>



<p class="wp-block-paragraph">For WordPress, Redis, mostly because the tooling and plugin ecosystem around it is better and you get richer diagnostics. Memcached is perfectly capable and slightly simpler. This is not a decision worth agonising over.</p>



<h3 class="wp-block-heading">How much memory should I give it?</h3>



<p class="wp-block-paragraph">Start modestly, watch memory used and evicted keys for a week, and raise it if evictions are constant while free memory remains. Sizing from an article is guessing; sizing from your own eviction counter is not.</p>



<h3 class="wp-block-heading">Is it safe to lose everything in Redis?</h3>



<p class="wp-block-paragraph">Yes, for an object cache. Everything in it is regenerable from MySQL, which is exactly why persistence is unnecessary. Losing it costs a burst of database load, not data.</p>



<h3 class="wp-block-heading">Why did my dashboard not get faster?</h3>



<p class="wp-block-paragraph">Check the cache is genuinely active first, then look at what else is slow: outbound HTTP calls during admin requests, a large autoloaded options blob, or the heartbeat. An object cache removes repeated database work and nothing else.</p>



<h3 class="wp-block-heading">Should staging share the production Redis?</h3>



<p class="wp-block-paragraph">It can, with a different database number and a different prefix. It is cleaner not to. Either way, set it as part of the restore process so a clone never inherits production&#8217;s cache namespace.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The one thing to remember</h2>



<p class="wp-block-paragraph">Redis ships configured to protect data it assumes you cannot afford to lose. You are storing data you could regenerate in a second. Every default that follows from that assumption, unlimited memory, no eviction, persistence to disk, is wrong for your use case and one of them can take the server down.</p>



<p class="wp-block-paragraph">So set <code>maxmemory</code> and an eviction policy before you enable the drop-in, give every install its own database and prefix, and verify with Site Health rather than a green dot. Then it is genuinely one of the best changes you can make to a WordPress site.</p>



<h2 class="wp-block-heading">Want it set up properly?</h2>



<p class="wp-block-paragraph">Object caching is quick to install and easy to get subtly wrong in ways that show up weeks later. Work I take on:</p>



<ul class="wp-block-list">
<li>Installing and tuning Redis object caching on a VPS or dedicated server, including memory limits, eviction and persistence settings.</li>
<li>Auditing an existing setup for shared namespaces, competing drop-ins and caches that are not actually active.</li>
<li>Multi-site and multi-environment configuration so staging can never touch production&#8217;s cache.</li>
<li>Cleaning up autoloaded options so the object cache is caching something sensible.</li>
<li>Monitoring for Redis memory, evictions and hit rate, wired into Prometheus and Grafana.</li>
<li>Diagnosing sites where caching was installed and nothing got faster.</li>
</ul>



<p class="wp-block-paragraph">Send me your Site Health info and <code>redis-cli INFO memory</code>, and I will tell you what is worth changing.</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="https://www.upwork.com/freelancers/~01f15a912ad84a6620" target="_blank" rel="noreferrer noopener">Work with me on Upwork</a></div>
</div>
<p>The post <a href="https://john-nessime.com/blog/technical-guides/redis-object-cache-wordpress/">The OOM Killer Took MySQL: Redis Object Caching for WordPress</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://john-nessime.com/blog/technical-guides/redis-object-cache-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Your Site Is Fast and Your Dashboard Is Not: Fixing a Slow WordPress Admin</title>
		<link>https://john-nessime.com/blog/wordpress/slow-wordpress-admin/</link>
					<comments>https://john-nessime.com/blog/wordpress/slow-wordpress-admin/#respond</comments>
		
		<dc:creator><![CDATA[John Nessime]]></dc:creator>
		<pubDate>Sat, 01 Aug 2026 09:24:34 +0000</pubDate>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Web Performance]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Autoloaded Options]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[Database Optimization]]></category>
		<category><![CDATA[Heartbeat API]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Object Cache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Query Monitor]]></category>
		<category><![CDATA[Website Performance]]></category>
		<category><![CDATA[WordPress Debugging]]></category>
		<category><![CDATA[WordPress Hosting]]></category>
		<category><![CDATA[wp-admin]]></category>
		<category><![CDATA[WP-CLI]]></category>
		<category><![CDATA[WP-Cron]]></category>
		<guid isPermaLink="false">https://john-nessime.com/blog/?p=58</guid>

					<description><![CDATA[<p>Your homepage loads instantly and your dashboard takes eight seconds. That is not a contradiction: wp-admin is the only part of your site that never gets cached. Here is where the time actually goes, in the order worth checking.</p>
<p>The post <a href="https://john-nessime.com/blog/wordpress/slow-wordpress-admin/">Your Site Is Fast and Your Dashboard Is Not: Fixing a Slow WordPress Admin</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">The ticket says the site is fine but the dashboard takes eight seconds. You check the homepage: loads instantly, green across the board in every speed test you throw at it. You log in, click Posts, and watch the spinner. Same server, same database, same plugins. One is fast and one is not.</p>



<p class="wp-block-paragraph">Here is the thing that explains almost every case of this, and it is worth getting straight before you touch a single setting: <strong>wp-admin is the only part of your site that never gets cached.</strong> Every page cache plugin, every CDN, every reverse proxy in front of WordPress explicitly excludes logged-in requests. It has to, otherwise you would serve one editor&#8217;s draft screen to another. So the front end you keep measuring is a static HTML file being handed over by Cloudflare or Nginx, and the dashboard is your actual application running end to end, every single time.</p>



<p class="wp-block-paragraph">A <strong>slow WordPress admin</strong> is not a separate problem from a slow site. It is the same problem, visible. The cache was hiding it, not fixing it.</p>



<p class="wp-block-paragraph">This post walks through where that time actually goes, in the order I check things: how to tell server time from browser time, the <code>wp_options</code> table, outbound HTTP requests that block your page load, admin-ajax and the heartbeat, wp-cron, database bloat, and the server underneath it. Plus the troubleshooting steps for the cases that do not fit the pattern.</p>



<h2 class="wp-block-heading">First, split the problem in two</h2>



<p class="wp-block-paragraph">Do not start changing things. Find out whether you are waiting on the server or on the browser, because the fixes have nothing in common.</p>



<p class="wp-block-paragraph">Open the browser dev tools, go to the Network tab, hard reload an admin page, and look at the document request. If TTFB on that first request is three seconds, the server is thinking and nothing you do to JavaScript will help. If TTFB is 200ms and the page still feels slow, you have a rendering problem: too many scripts, a bloated admin notice area, a media grid loading hundreds of full-size images.</p>



<p class="wp-block-paragraph">For server-side time, install <a href="https://wordpress.org/plugins/query-monitor/" target="_blank" rel="noreferrer noopener">Query Monitor</a>. It is the single most useful diagnostic tool in the WordPress ecosystem and it costs nothing. It gives you, per admin page load: total queries and their time, which queries came from which plugin, every HTTP request WordPress made server-side and how long each took, hook timings, and PHP errors. Nine times out of ten the answer is sitting in the HTTP API panel or the Queries panel, and you will have it in under a minute.</p>



<p class="wp-block-paragraph">One caution: Query Monitor itself adds overhead, so use it to find the culprit, then deactivate it before you measure the improvement.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The invisible one: your autoloaded options</h2>



<p class="wp-block-paragraph">This is the failure that hides for years and then bites everybody at once, and it is where I look first on any slow WordPress admin.</p>



<p class="wp-block-paragraph">WordPress loads every option marked as autoload in one query at the start of <em>every single request</em>, then unserializes the lot into memory. That design is fine when the total is a few dozen kilobytes. It stops being fine when a page builder decides to autoload its full asset manifest, a slider plugin stores every slide&#8217;s settings in one row, an analytics plugin caches an API response there, and three plugins you uninstalled two years ago left their rows behind.</p>



<p class="wp-block-paragraph">Now every admin click pulls several megabytes out of MySQL and runs it through PHP&#8217;s unserializer before WordPress has drawn anything. No error, no warning, no slow query in the log worth noticing. Just a tax on every request.</p>



<h3 class="wp-block-heading">Measuring it</h3>



<p class="wp-block-paragraph">There is a trap in the usual SQL query you will find online. WordPress 6.6 changed the <code>autoload</code> column from a simple yes/no to a set of values: <code>on</code>, <code>off</code>, <code>auto</code>, <code>auto-on</code>, <code>auto-off</code>. Older rows keep <code>yes</code> and <code>no</code>, and there is no upgrade routine, so a real site has a mix. Querying only for <code>autoload = 'yes'</code> undercounts, sometimes badly.</p>



<pre class="wp-block-code"><code>-- Total bytes loaded on every request.
-- Adjust wp_ if your table prefix is different.
SELECT SUM(LENGTH(option_value)) AS autoload_bytes
FROM wp_options
WHERE autoload IN ('yes', 'on', 'auto', 'auto-on');

-- The worst offenders, largest first.
SELECT option_name, LENGTH(option_value) AS size_bytes
FROM wp_options
WHERE autoload IN ('yes', 'on', 'auto', 'auto-on')
ORDER BY size_bytes DESC
LIMIT 25;</code></pre>



<p class="wp-block-paragraph">If you have WP-CLI, this is quicker and you do not need database credentials:</p>



<pre class="wp-block-code"><code># Total size of everything autoloaded, in bytes.
wp option list --autoload=on --format=total_bytes

# Biggest autoloaded options. Note the sort happens in the shell:
# wp option list only sorts by option_id, option_name or option_value.
wp option list --autoload=on --fields=option_name,size_bytes | sort -n -k 2 | tail -25</code></pre>



<p class="wp-block-paragraph">Site Health flags this too, under Tools then Site Health, once the total crosses core&#8217;s threshold. Treat that warning as an audit trigger rather than a number to chase.</p>



<h3 class="wp-block-heading">Fixing it without breaking anything</h3>



<p class="wp-block-paragraph">Read the list before you delete anything. You are looking for three categories:</p>



<ul class="wp-block-list">
<li><strong>Orphans.</strong> Options with the prefix of a plugin that is no longer installed. Safe to delete after a backup.</li>
<li><strong>Wrongly autoloaded.</strong> Settings for a plugin that only ever runs on one admin screen. These should not be autoloaded, but they should not be deleted either.</li>
<li><strong>Cache data in the wrong place.</strong> A plugin storing an API response or an asset map as a permanent option. Usually safe to delete, because the plugin will rebuild it, but check that assumption on staging first.</li>
</ul>



<p class="wp-block-paragraph">For the middle category, flip autoload off instead of deleting. Use the WordPress API rather than raw SQL, because a direct <code>UPDATE</code> leaves the object cache holding the old value and you will spend twenty minutes convinced nothing changed:</p>



<pre class="wp-block-code"><code># Stop autoloading a specific option. Run once, then remove.
wp eval "wp_set_option_autoload( 'some_plugin_bulky_setting', false );"</code></pre>



<p class="wp-block-paragraph">While you are in there, clear out expired transients. They live in the same table and orphaned ones accumulate quietly, especially on sites that have been through a few plugin migrations:</p>



<pre class="wp-block-code"><code>wp transient delete --expired</code></pre>



<h2 class="wp-block-heading">Outbound HTTP requests that block your page load</h2>



<p class="wp-block-paragraph">This one is regional and it catches people out badly. WordPress makes server-side HTTP calls during admin requests: core update checks, plugin and theme update checks, the Events and News dashboard widget, and whatever your commercial plugins do to phone home for licence validation.</p>



<p class="wp-block-paragraph">Those calls are synchronous. If the endpoint is slow to reach from your server, or a firewall is silently dropping the packets rather than refusing them, PHP sits there until the timeout expires. Two plugins doing that with a five-second timeout each is ten seconds of dashboard, and absolutely nothing in the interface tells you why.</p>



<p class="wp-block-paragraph">Query Monitor&#8217;s HTTP API panel shows every one of these with its duration, which is usually enough. To confirm from the server directly:</p>



<pre class="wp-block-code"><code># How long does the server take to reach the WordPress.org API?
# -w prints the timing, -o discards the body, -s hides the progress meter.
curl -w "%{time_total}n" -o /dev/null -s https://api.wordpress.org/core/version-check/1.7/</code></pre>



<p class="wp-block-paragraph">If that takes seconds, or hangs, you have found it. For a pure diagnostic, you can temporarily block all outbound HTTP from WordPress and see whether the dashboard snaps back:</p>



<pre class="wp-block-code"><code>// wp-config.php, ABOVE the "stop editing" line.
// DIAGNOSTIC ONLY. This breaks updates, licence checks and
// anything else that calls out. Remove it once you have your answer.
define( 'WP_HTTP_BLOCK_EXTERNAL', true );

// Optionally allow specific hosts back through while testing.
define( 'WP_ACCESSIBLE_HOSTS', 'api.wordpress.org,*.wordpress.org' );</code></pre>



<p class="wp-block-paragraph">Do not leave that in place as a fix. If outbound connectivity is genuinely the problem, the real solution is at the network layer: fix the firewall rule, fix DNS resolution on the box, or move to a host that does not throttle outbound connections. If you are on shared hosting and cannot influence any of that, a small VPS from somewhere like InterServer will usually behave better than a crowded shared box, purely because you control the network stack.</p>



<p class="wp-block-paragraph">The dashboard news widget is the one piece here you can just remove, and most teams never look at it:</p>



<pre class="wp-block-code"><code>// In a site-specific plugin, not in a parent theme.
add_action( 'wp_dashboard_setup', function () {
    remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
} );</code></pre>



<h2 class="wp-block-heading">admin-ajax.php and the heartbeat</h2>



<p class="wp-block-paragraph">Open the Network tab in dev tools, filter on <code>admin-ajax.php</code>, and leave a dashboard tab sitting idle for two minutes. You will see requests firing on a timer. That is the Heartbeat API, and it powers autosave, post locking, and session expiry warnings. Those are real features and you should not rip them out.</p>



<p class="wp-block-paragraph">The cost is that each tick boots WordPress, loads every active plugin, runs any handlers hooked into it, and occupies a PHP worker for the duration. The post editor ticks fastest because autosave needs to feel responsive; other admin screens tick more slowly. Multiply by every open tab and every logged-in editor, and on a small server you can spend a meaningful share of your PHP workers on polling.</p>



<p class="wp-block-paragraph">The proportionate fix is to slow it down rather than kill it:</p>



<pre class="wp-block-code"><code>// Slow the heartbeat down across admin screens.
// Core clamps this to its allowed range, so an out-of-range
// value is quietly ignored rather than applied.
add_filter( 'heartbeat_settings', function ( $settings ) {
    $settings['interval'] = 60;
    return $settings;
} );</code></pre>



<p class="wp-block-paragraph">Worth being honest about the trade-off: at a longer interval, autosave and post-lock detection get less immediate. On a single-author blog that is invisible. On a newsroom where three people edit the same article, post locking becoming less prompt is a genuine cost and you should leave the editor alone and throttle elsewhere.</p>



<p class="wp-block-paragraph">Heartbeat is not the only thing hitting that endpoint. Cart fragments, live search, popup builders, notification pollers and bots all target <code>admin-ajax.php</code>. Look at the <code>action</code> parameter in the request payload to see which plugin is responsible, then deal with that plugin rather than blaming the endpoint.</p>



<h2 class="wp-block-heading">wp-cron riding along on your admin requests</h2>



<p class="wp-block-paragraph">WordPress has no scheduler of its own. It checks for due tasks on page loads and fires them off, which means somebody&#8217;s page view pays for your backup job, your feed import and your email queue. On a low-traffic site the person unlucky enough to be that page view is usually you, logged in, clicking around the admin.</p>



<pre class="wp-block-code"><code># What is scheduled, and is anything badly overdue?
wp cron event list

# Run everything due right now, so you can time it in isolation.
wp cron event run --due-now</code></pre>



<p class="wp-block-paragraph">A long list of overdue events means cron is not firing reliably, which is its own problem. The fix is to take the scheduler off page loads and give it to the operating system:</p>



<pre class="wp-block-code"><code>// wp-config.php
define( 'DISABLE_WP_CRON', true );</code></pre>



<pre class="wp-block-code"><code># crontab -e, as the user that owns the WordPress files.
# Every five minutes is enough for most sites.
*/5 * * * * cd /var/www/example.com &amp;&amp; wp cron event run --due-now &gt;/dev/null 2&gt;&amp;1</code></pre>



<p class="wp-block-paragraph">The order matters. Set the constant and the system cron in the same change, because if you disable wp-cron and forget the cron job, scheduled posts stop publishing and nobody notices for a week.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Database bloat, and the list tables that trip over it</h2>



<p class="wp-block-paragraph">Admin list screens do work the front end never does. Counting posts by status for those &#8220;All | Published | Draft&#8221; links, joining postmeta for sortable columns, building filter dropdowns from distinct values. All of it scales with table size, and none of it is cached.</p>



<pre class="wp-block-code"><code># Which tables are actually large?
wp db size --tables --human-readable</code></pre>



<p class="wp-block-paragraph">What usually turns up:</p>



<ul class="wp-block-list">
<li><strong><code>wp_postmeta</code> far larger than <code>wp_posts</code>.</strong> Normal to a point. Suspicious when the ratio is extreme, which usually means a plugin writing meta per page view.</li>
<li><strong>Revisions.</strong> Every save keeps a full copy of the post. Cap them with <code>define( 'WP_POST_REVISIONS', 10 );</code> in wp-config, which limits new ones without touching existing content.</li>
<li><strong>Action Scheduler tables</strong> on WooCommerce sites. Completed actions accumulate. There is a cleanup screen under WooCommerce tools, and it is worth checking before you assume the store itself is slow.</li>
<li><strong>Spam and trashed comments</strong> still counted by every dashboard widget that shows a comment count.</li>
</ul>



<p class="wp-block-paragraph">Two quick wins that need no database work at all. Use Screen Options at the top right of any list table to drop the per-page count from twenty to ten on a slow screen. And switch the Media Library from grid view to list view, because the grid loads far more per scroll.</p>



<h2 class="wp-block-heading">The server underneath</h2>



<p class="wp-block-paragraph">If the application is clean and the admin is still slow, look down a layer. Site Health covers most of it, under Tools then Site Health then Info.</p>



<ul class="wp-block-list">
<li><strong>No persistent object cache.</strong> Without one, every options lookup and every transient read goes to MySQL on every request. Adding Redis or Memcached with the matching drop-in is often the single biggest improvement available to an admin-heavy site, because the admin is exactly the workload that benefits.</li>
<li><strong>OPcache disabled.</strong> PHP recompiling every WordPress file on every request. Free to enable, immediately noticeable.</li>
<li><strong>An old PHP version.</strong> Upgrading a WordPress site&#8217;s PHP is usually the cheapest performance work available, and it is a security matter regardless.</li>
<li><strong>PHP-FPM worker exhaustion.</strong> If requests are queuing for a worker, every page waits, and the admin waits longest because it holds a worker for the whole request. Check the pool status and the error log before adding more workers, because a worker shortage is often a symptom of slow requests rather than the cause.</li>
<li><strong>A low memory limit.</strong> The admin needs more than the front end, especially plugin and update screens.</li>
</ul>



<p class="wp-block-paragraph">If you run your own server, track admin response time the same way you track front-end response time. Scraping PHP-FPM and MySQL metrics into Prometheus and graphing them in Grafana costs an afternoon and turns &#8220;the dashboard feels slower lately&#8221; into something you can actually see.</p>



<h2 class="wp-block-heading">Troubleshooting</h2>



<h3 class="wp-block-heading">Only one admin screen is slow</h3>



<p class="wp-block-paragraph">That points at a specific plugin, not the platform. Query Monitor on that exact screen will name the caller. Common culprits are the plugins list (update checks for every installed plugin) and any settings page that fetches remote data to populate a dropdown.</p>



<h3 class="wp-block-heading">Slow only for some users</h3>



<p class="wp-block-paragraph">Check user meta. Some plugins store per-user data such as dismissed notices, column preferences or activity logs, and one user&#8217;s row can grow enormous. Also check whether the slow users are administrators, since admins load update checks and notices that editors do not.</p>



<h3 class="wp-block-heading">Fast for a while after clearing cache, then slow again</h3>



<p class="wp-block-paragraph">Something is rebuilding a large transient or option on a schedule and it is expensive. Watch <code>wp_options</code> row sizes over a day, or check the cron list for a job that lines up with the slowdown.</p>



<h3 class="wp-block-heading">Slow in one browser or on one machine only</h3>



<p class="wp-block-paragraph">Not a server problem. Test in a private window with extensions disabled. Ad blockers and password managers interact badly with some admin screens, and a stale service worker from a caching plugin can serve half-broken admin assets.</p>



<h3 class="wp-block-heading">Everything looks fine but it is still slow</h3>



<p class="wp-block-paragraph">Bisect on staging, never production. Deactivate all plugins, confirm the admin is fast, then reactivate in halves rather than one at a time. Switch to a default theme too, because <code>functions.php</code> in a commercial theme can do as much work as a plugin.</p>



<h2 class="wp-block-heading">Common mistakes</h2>



<p class="wp-block-paragraph">Things I would push back on if you suggested them:</p>



<ul class="wp-block-list">
<li>Judging admin performance by front-end speed test scores. Those measure a cached HTML file.</li>
<li>Installing a second caching plugin because the first one &#8220;did not fix the dashboard&#8221;. No page cache will ever cache wp-admin.</li>
<li>Running an <code>UPDATE</code> against the <code>autoload</code> column directly, then wondering why nothing changed. The object cache still holds the old values.</li>
<li>Only counting <code>autoload = 'yes'</code> and concluding the table is fine.</li>
<li>Disabling the heartbeat completely, then losing work when two people edit the same post.</li>
<li>Setting <code>DISABLE_WP_CRON</code> without adding a real cron job.</li>
<li>Deleting rows from <code>wp_options</code> without a backup, or without checking on staging first.</li>
<li>Leaving <code>WP_HTTP_BLOCK_EXTERNAL</code> in place because it made the dashboard fast. It also stopped your security updates.</li>
<li>Adding PHP-FPM workers to hide slow requests instead of finding out why they are slow.</li>
<li>Deactivating plugins one at a time on a live site during business hours.</li>
</ul>



<h2 class="wp-block-heading">Best practices</h2>



<ul class="wp-block-list">
<li>Measure with Query Monitor before changing anything, and measure again with it deactivated.</li>
<li>Check autoloaded option size whenever you install, remove or update a major plugin.</li>
<li>Remove uninstalled plugins&#8217; leftover rows as part of routine maintenance, not as an emergency.</li>
<li>Run a persistent object cache on any site where people spend real time in the admin.</li>
<li>Move wp-cron to a system cron job on every site you manage.</li>
<li>Cap post revisions rather than deleting them in bulk later.</li>
<li>Keep a staging copy so bisecting plugins never happens on production.</li>
<li>Treat Site Health warnings as a starting point for investigation, not a checklist to silence.</li>
<li>Uninstall plugins properly instead of deactivating them and leaving them installed, since update checks still run for installed plugins.</li>
<li>Watch admin response time over time, so you catch a slow regression before somebody files a ticket.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">FAQ</h2>



<h3 class="wp-block-heading">Why is my WordPress dashboard slow when the site itself is fast?</h3>



<p class="wp-block-paragraph">Because the front end is being served from a cache and the dashboard cannot be. Page caches and CDNs bypass logged-in requests by design, so wp-admin runs the full PHP and MySQL stack on every click. The dashboard is showing you your site&#8217;s real uncached performance.</p>



<h3 class="wp-block-heading">Will a caching plugin speed up wp-admin?</h3>



<p class="wp-block-paragraph">Not the page caching part, no. What can help is the object caching side, if your caching plugin ships one, because that caches option and transient lookups rather than whole pages. Redis or Memcached with the matching drop-in does the same job more reliably.</p>



<h3 class="wp-block-heading">How much autoloaded data is too much?</h3>



<p class="wp-block-paragraph">Core&#8217;s Site Health check will tell you when you have crossed its threshold, and that is the number to work against rather than one from an article. More usefully: if a single option is measured in hundreds of kilobytes, look at it regardless of the total, because one bad row is easier to fix than a general diet.</p>



<h3 class="wp-block-heading">Is it safe to delete rows from wp_options?</h3>



<p class="wp-block-paragraph">With a backup and a staging test, yes for orphaned rows from plugins you have removed. For anything belonging to an active plugin, turn autoload off instead of deleting, and use <code>wp_set_option_autoload()</code> rather than raw SQL so the object cache stays consistent.</p>



<h3 class="wp-block-heading">Should I disable the Heartbeat API?</h3>



<p class="wp-block-paragraph">Throttle it, do not disable it. Turning it off entirely breaks autosave and post locking, which is a bad trade for a site with more than one editor. Raising the interval keeps both working and removes most of the load.</p>



<h3 class="wp-block-heading">Does the number of plugins matter?</h3>



<p class="wp-block-paragraph">Less than people assume. Twenty well-written plugins can cost less than one that runs a remote API call on <code>admin_init</code>. Count what each plugin does per request, not how many are in the list. Query Monitor attributes queries and HTTP calls to specific plugins, which turns this from a guess into a measurement.</p>



<h3 class="wp-block-heading">Will better hosting fix a slow WordPress admin?</h3>



<p class="wp-block-paragraph">It helps when the constraint is genuinely the server: no OPcache, no object cache, throttled CPU, a shared MySQL instance under load. It does nothing for four megabytes of autoloaded options or a plugin blocking on a remote API. Diagnose first, because moving a slow site to a faster server usually gives you a slightly less slow site and a new bill.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The one thing to remember</h2>



<p class="wp-block-paragraph">Your dashboard is not a separate, badly built part of WordPress. It is the only place you ever see your site running without a cache in front of it, which makes it the most honest performance signal you have. A slow WordPress admin is telling you something true about the application, and the front end has been politely covering for it.</p>



<p class="wp-block-paragraph">So measure before you change anything, and go in this order: autoloaded options, outbound HTTP requests, admin-ajax traffic, cron, database size, then the server. That sequence puts the highest-yield, lowest-risk checks first, and most of the time you will not get past the second one.</p>



<h2 class="wp-block-heading">Need someone to find where the time is going?</h2>



<p class="wp-block-paragraph">Diagnosing a slow admin is mostly measurement discipline, and it goes faster with someone who has looked at a lot of these. Work I take on regularly:</p>



<ul class="wp-block-list">
<li>Profiling a slow WordPress admin and reporting back with the actual cause, named, rather than a list of generic tips.</li>
<li>Cleaning up <code>wp_options</code> and autoloaded data safely, tested on staging before it touches production.</li>
<li>Setting up Redis or Memcached object caching, OPcache and PHP-FPM tuning on a VPS or dedicated server.</li>
<li>Moving wp-cron to system cron and fixing scheduled jobs that have quietly stopped running.</li>
<li>Database maintenance: revisions, orphaned meta, Action Scheduler cleanup on WooCommerce sites, and indexing where it genuinely helps.</li>
<li>Adding proper monitoring so admin performance regressions show up on a graph instead of in a complaint.</li>
</ul>



<p class="wp-block-paragraph">Send me a Site Health info report and a Query Monitor screenshot from your slowest admin screen, and I will tell you what I would look at first.</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="https://www.upwork.com/freelancers/~01f15a912ad84a6620" target="_blank" rel="noreferrer noopener">Work with me on Upwork</a></div>
</div>
<p>The post <a href="https://john-nessime.com/blog/wordpress/slow-wordpress-admin/">Your Site Is Fast and Your Dashboard Is Not: Fixing a Slow WordPress Admin</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://john-nessime.com/blog/wordpress/slow-wordpress-admin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Two Sources of Truth: Git-Based WordPress Deployment From Local to Production</title>
		<link>https://john-nessime.com/blog/devops/git-based-wordpress-deployment/</link>
					<comments>https://john-nessime.com/blog/devops/git-based-wordpress-deployment/#respond</comments>
		
		<dc:creator><![CDATA[John Nessime]]></dc:creator>
		<pubDate>Sat, 01 Aug 2026 09:24:28 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Technical Guides]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Bedrock]]></category>
		<category><![CDATA[CI/CD]]></category>
		<category><![CDATA[Composer]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[GitHub Actions]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[Staging]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[WordPress Database]]></category>
		<category><![CDATA[WordPress Hosting]]></category>
		<category><![CDATA[WordPress Migration]]></category>
		<category><![CDATA[WP-CLI]]></category>
		<guid isPermaLink="false">https://john-nessime.com/blog/?p=60</guid>

					<description><![CDATA[<p>A plugin quietly reverts after every deploy and nobody knows why. That is what happens when Git and wp-admin both think they own the file tree. Here is how to build a deployment workflow where the repo is the source of truth and the database only ever travels one way.</p>
<p>The post <a href="https://john-nessime.com/blog/devops/git-based-wordpress-deployment/">Two Sources of Truth: Git-Based WordPress Deployment From Local to Production</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Someone reports that the contact form stopped working. You check the log, and nothing has touched that plugin in three weeks. You SSH into production, look at the plugin directory, and the version on disk is older than the version in your repo. Older than production had yesterday, in fact.</p>



<p class="wp-block-paragraph">Then it clicks. Somebody logged into wp-admin last month, saw an update notice, clicked it. The plugin got updated on the server and never in git. Last night&#8217;s deploy synced the repo over the top and put the old version back, along with the vulnerability the update was patching. No error, no warning. The deploy did exactly what it was told.</p>



<p class="wp-block-paragraph">That is the failure mode that kills most attempts at <strong>Git-based WordPress deployment</strong>, and it has nothing to do with your pipeline. WordPress is designed to modify itself. It installs plugins, updates core, writes files, all from the browser. The moment you put it under version control you have two systems that both believe they own the file tree, and they will quietly overwrite each other until somebody notices.</p>



<p class="wp-block-paragraph">This post covers the whole chain: what belongs in the repo, how to shut the second write path, how configuration differs per environment, which way the database is allowed to travel, and how to make staging safe enough that you can restore production data into it without emailing your customers by accident.</p>



<h2 class="wp-block-heading">The two things that make WordPress awkward under Git</h2>



<p class="wp-block-paragraph">Everything in this workflow follows from two facts.</p>



<p class="wp-block-paragraph"><strong>State is split across files and a database.</strong> Your theme is code. Your posts are data. But so are your plugin settings, your menus, your widget layouts, and your permalink structure, and those live in the database next to the content. Git only manages half your site, and it is not obvious which half a given change landed in.</p>



<p class="wp-block-paragraph"><strong>The two halves travel in opposite directions.</strong> Code moves forward, local to staging to production. Content moves backward, production to staging to local. Once a site is live, production is the only authoritative source of orders, comments and posts, and pushing a database upward destroys everything written since your last pull.</p>



<p class="wp-block-paragraph">Write that rule somewhere the whole team can see it. Almost every catastrophic WordPress deployment story is somebody pushing a database in the wrong direction.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Decide what actually goes in the repo</h2>



<p class="wp-block-paragraph">Three approaches, in increasing order of discipline and payoff. Pick one deliberately rather than drifting into the first.</p>



<ol class="wp-block-list">
<li><strong>Theme only.</strong> The repo contains one custom theme, sometimes a custom plugin. Everything else is installed through wp-admin. Easy to start, and it means you have no reproducible build: rebuilding the site from the repo is impossible.</li>
<li><strong>All of wp-content, minus uploads.</strong> Themes, plugins and mu-plugins in git; core and media excluded. This is the pragmatic middle and where most teams land. You get reproducible plugin versions and a real diff when a plugin changes.</li>
<li><strong>Composer-managed, Bedrock-style.</strong> Core, plugins and themes are all declared as dependencies. The repo holds a <code>composer.json</code> and your own code, nothing else. The lockfile is the source of truth and <code>composer install</code> rebuilds the site anywhere.</li>
</ol>



<p class="wp-block-paragraph">Option three is the one I reach for on anything with more than one developer, because &#8220;which plugin version is production running&#8221; becomes a question with an answer. The honest cost: premium plugins that are not on a Composer repository need either a private repository or a manual step, and that friction is real. If most of your plugin stack is commercial, option two is a reasonable place to stop.</p>



<p class="wp-block-paragraph">One thing to check if you are following an older tutorial. The Composer repository landscape for WordPress plugins shifted recently: WPackagist was acquired by WP Engine, and the Roots team launched WP Packages as an independent alternative with different package naming. Both work. Any guide written before that change will use the older <code>wpackagist-plugin/</code> prefix, so make sure the repository URL and the prefixes in your <code>composer.json</code> match each other.</p>



<h3 class="wp-block-heading">The gitignore that matters</h3>



<pre class="wp-block-code"><code># Secrets and machine-specific config. Never committed.
wp-config.php
.env

# Content, not code. This gets pulled down from production,
# it never gets deployed up.
wp-content/uploads/

# Generated at runtime or by the build.
wp-content/cache/
wp-content/upgrade/
wp-content/debug.log
node_modules/
vendor/</code></pre>



<p class="wp-block-paragraph">Ignoring <code>vendor/</code> assumes your deploy runs <code>composer install</code>. If your pipeline just rsyncs the repo with no build step, commit it instead, or you will ship a site with no dependencies. Decide which, then be consistent, because half-and-half is how you end up with a missing autoloader at two in the morning.</p>



<h2 class="wp-block-heading">Close the second write path</h2>



<p class="wp-block-paragraph">This is the step people skip, and it is the one that makes everything else work. If production can still install and update plugins from the browser, your repo is not the source of truth. It is a suggestion.</p>



<pre class="wp-block-code"><code>// wp-config.php on production and staging.

// Removes the ability to install, update or delete plugins and
// themes from the admin. Also disables the built-in file editor,
// so DISALLOW_FILE_EDIT is implied by this one.
define( 'DISALLOW_FILE_MODS', true );

// Stops core from updating itself behind your back, including
// the automatic minor updates that would otherwise change files
// your deploy is about to overwrite.
define( 'AUTOMATIC_UPDATER_DISABLED', true );</code></pre>



<p class="wp-block-paragraph">Be clear-eyed about the trade-off, because it is a real one. You have just taken away automatic security updates. That is only an improvement if you replace them with something: a scheduled dependency update job, a weekly review of the update list, a bot that opens a pull request when a plugin version changes. If you disable updates and then do nothing, you have made the site less safe, not more controlled.</p>



<p class="wp-block-paragraph">The update flow now runs through the repo. On your local machine:</p>



<pre class="wp-block-code"><code># Composer-managed: bump the lockfile, commit it, deploy.
composer update wp-plugin/some-plugin

# wp-content-in-git: let WP-CLI do the download locally,
# then commit the resulting file changes as a normal diff.
wp plugin update some-plugin</code></pre>



<p class="wp-block-paragraph">The second form is worth appreciating. A plugin update becomes a reviewable diff. When something breaks two days later, <code>git log</code> tells you exactly which files changed and <code>git revert</code> puts them back.</p>



<h2 class="wp-block-heading">Configuration per environment</h2>



<p class="wp-block-paragraph">Database credentials, salts and API keys differ per environment and none of them belong in git. Keep <code>wp-config.php</code> out of the repo and place it on each server, or use an environment file with a committed <code>.env.example</code> showing the required keys with no values.</p>



<p class="wp-block-paragraph">Core has a first-class way to tell environments apart, and it is underused:</p>



<pre class="wp-block-code"><code>// Per environment, in wp-config.php.
// Recognised values: 'local', 'development', 'staging', 'production'.
define( 'WP_ENVIRONMENT_TYPE', 'staging' );</code></pre>



<pre class="wp-block-code"><code>&lt;?php
// mu-plugin, committed to the repo, safe on every environment
// because it checks where it is running.

if ( wp_get_environment_type() !== 'production' ) {

    // Keep non-production sites out of search results.
    add_filter( 'pre_option_blog_public', '__return_zero' );

    // Short-circuit wp_mail() entirely. Returning a non-null
    // value stops WordPress before it hands anything to PHPMailer.
    add_filter( 'pre_wp_mail', '__return_false' );
}</code></pre>



<p class="wp-block-paragraph">That mail filter is the single most valuable line in this post. Restore a production database onto staging, forget this, and the first cron run mails real order confirmations, password resets and abandoned-cart nudges to real customers from a URL that does not work. It is silent until it is very loud.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Moving the database in the allowed direction</h2>



<p class="wp-block-paragraph">Set up WP-CLI aliases once and the rest becomes short commands instead of a runbook nobody follows.</p>



<pre class="wp-block-code"><code># wp-cli.yml in the project root, committed to the repo.
@staging:
  ssh: deploy@staging.example.com/var/www/staging.example.com
@production:
  ssh: deploy@example.com/var/www/example.com</code></pre>



<p class="wp-block-paragraph">Now pulling production down to your machine is one pipe. The trailing hyphen means &#8220;write the dump to standard output&#8221;, and the leading hyphen on the import means &#8220;read it from standard input&#8221;, so nothing touches disk:</p>



<pre class="wp-block-code"><code># Back up your local database first, then overwrite it.
wp db export local-backup.sql
wp @production db export - | wp db import -</code></pre>



<p class="wp-block-paragraph">The URLs inside that dump still point at production, and they are buried in serialized PHP arrays where a plain SQL find-and-replace corrupts the string length prefixes. This is exactly what <code>wp search-replace</code> exists for: it unserializes, replaces, and reserializes properly.</p>



<pre class="wp-block-code"><code># Always dry-run first and actually read the table list it prints.
wp search-replace 'https://example.com' 'https://example.test' 
  --all-tables-with-prefix --skip-columns=guid --dry-run

# Then for real.
wp search-replace 'https://example.com' 'https://example.test' 
  --all-tables-with-prefix --skip-columns=guid

wp cache flush</code></pre>



<p class="wp-block-paragraph">Two flags worth understanding rather than copying:</p>



<ul class="wp-block-list">
<li><strong><code>--skip-columns=guid</code></strong> because the <code>guid</code> column is a permanent identifier that feed readers and external systems use to decide whether they have already seen a post. Rewriting it makes subscribers re-receive your entire archive, and you find out from an angry email weeks later.</li>
<li><strong><code>--all-tables-with-prefix</code></strong> because plugins create their own tables using your prefix, and those tables are not registered with WordPress. Without this, the replacement misses them and you get half-migrated URLs in places nobody checks.</li>
</ul>



<p class="wp-block-paragraph">Uploads are the other half of the content problem. Do not put them in git; a media library will outgrow a repository quickly and every clone pays for it. Sync them separately with <code>rsync</code> when you need them, or skip them entirely locally and let a plugin proxy missing images from production. Offloading media to object storage sidesteps the question completely and is worth considering on any site with a large library.</p>



<h2 class="wp-block-heading">The deploy itself</h2>



<p class="wp-block-paragraph">Three broad options. <code>git pull</code> on the server is the simplest and the one I would move away from first: it puts a <code>.git</code> directory next to your document root, it has no build step, and a failed pull leaves the site half-updated. Rsync from CI is the pragmatic default. Atomic releases with a symlink swap, the way Deployer or Capistrano work, are the most correct because the site switches versions instantly and rollback is a symlink change.</p>



<p class="wp-block-paragraph">A workable rsync deploy from GitHub Actions, with staging on merge and production on tag:</p>



<pre class="wp-block-code"><code>name: Deploy
on:
  push:
    branches: [main]     # goes to staging
    tags: ['v*']         # goes to production

jobs:
  deploy:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4    # pin to a full SHA in production

      - name: Build
        run: |
          composer install --no-dev --optimize-autoloader
          npm ci
          npm run build

      - name: Sync files
        run: |
          echo "$DEPLOY_KEY" &gt; deploy_key
          chmod 600 deploy_key
          rsync -az --delete 
            -e "ssh -i deploy_key -o StrictHostKeyChecking=accept-new" 
            --exclude-from=.deployignore 
            ./ "$TARGET"
        env:
          DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
          TARGET: ${{ secrets.DEPLOY_TARGET }}</code></pre>



<p class="wp-block-paragraph"><code>--delete</code> is what makes the target match the source exactly, which is the entire point of a deploy. It is also the flag that will erase your uploads directory if <code>.deployignore</code> is wrong. Test the exclude list against staging before you ever point this at production, and use <code>--dry-run</code> the first time.</p>



<p class="wp-block-paragraph">Files landing on the server is not the same as a working deploy. Run a post-deploy step over SSH:</p>



<pre class="wp-block-code"><code>#!/usr/bin/env bash
set -euo pipefail

cd /var/www/example.com

# Applies schema changes that a core or plugin version bump needs.
# Safe to run when there is nothing to do.
wp core update-db

# Rewrite rules live in the database, so a plugin that registers
# new routes needs this or you get 404s on the new URLs.
wp rewrite flush

# Options and transients are cached; stale ones survive a file deploy.
wp cache flush

# Prove the site answers before you call the deploy finished.
# --fail makes curl exit non-zero on a 5xx instead of shrugging.
curl --fail --silent --show-error https://example.com/ &gt; /dev/null</code></pre>



<p class="wp-block-paragraph">If you run PHP-FPM with OPcache, add a reset to that script. Otherwise PHP happily serves the previous version of your code from its compiled cache and you spend twenty minutes convinced the deploy did not run.</p>



<h2 class="wp-block-heading">Making staging safe to hold real data</h2>



<p class="wp-block-paragraph">Staging is only useful if it mirrors production, and the moment it does it becomes dangerous. Every one of these has bitten somebody:</p>



<ul class="wp-block-list">
<li><strong>Outbound email.</strong> Covered above. Kill it at the <code>wp_mail()</code> level rather than trusting a plugin setting somebody can toggle.</li>
<li><strong>Cron.</strong> A restored production database brings production&#8217;s scheduled jobs with it. Set <code>DISABLE_WP_CRON</code> on staging and do not add a system cron job unless you specifically need to test scheduling.</li>
<li><strong>Payment gateways.</strong> The database carries live API keys. Overwrite them with test-mode credentials as part of your restore script, not by hand afterwards.</li>
<li><strong>Search indexing.</strong> Filter <code>blog_public</code> as shown, and put HTTP basic auth in front of the whole environment. Duplicate content ranking above your real site is an avoidable embarrassment.</li>
<li><strong>Personal data.</strong> A production restore is real customer data on a server that probably has weaker access controls. Either anonymise user records during the restore or treat staging with the same seriousness as production.</li>
</ul>



<p class="wp-block-paragraph">Write the restore as a single script that does all of this in order, so nobody has to remember step four. If it is a checklist in a wiki, it will be skipped.</p>



<h2 class="wp-block-heading">Troubleshooting</h2>



<h3 class="wp-block-heading">The deploy ran but the site is unchanged</h3>



<p class="wp-block-paragraph">In order: OPcache serving compiled bytecode, a page cache or CDN holding the old response, or rsync excluding the directory you edited. Check them in that order. Confirm the file on disk actually changed before blaming anything upstream of it.</p>



<h3 class="wp-block-heading">White screen immediately after deploying</h3>



<p class="wp-block-paragraph">Usually a missing autoloader, meaning <code>vendor/</code> was neither committed nor built. Check the PHP error log rather than guessing. A memory limit lower on the server than locally is the other common cause, and it produces the same blank page.</p>



<h3 class="wp-block-heading">Site works, admin redirects in a loop</h3>



<p class="wp-block-paragraph"><code>siteurl</code> and <code>home</code> in the options table disagree with the URL you are actually using. Almost always a search-replace that missed. Check with <code>wp option get siteurl</code> and <code>wp option get home</code>, and set them explicitly with <code>wp option update</code> rather than running the replacement again.</p>



<h3 class="wp-block-heading">Serialized data broken after a migration</h3>



<p class="wp-block-paragraph">Somebody ran <code>sed</code> or a SQL <code>REPLACE</code> on the dump. The length prefix inside each serialized string no longer matches the string, so PHP silently fails to unserialize and widgets, theme options and ACF fields come back empty. Restore from the dump and redo it with <code>wp search-replace</code>. There is no partial recovery worth attempting.</p>



<h3 class="wp-block-heading">Permalinks return 404 after deploy</h3>



<p class="wp-block-paragraph">Rewrite rules are stored in the database and did not get regenerated. Run <code>wp rewrite flush</code>. If it recurs on every deploy, add it to the post-deploy script permanently.</p>



<h3 class="wp-block-heading">Plugin reverts to an older version after every deploy</h3>



<p class="wp-block-paragraph">Somebody is still updating in wp-admin. That is not a pipeline bug, it is the second write path being open. Set <code>DISALLOW_FILE_MODS</code> and give the team a documented way to request an update.</p>



<h2 class="wp-block-heading">Common mistakes</h2>



<ul class="wp-block-list">
<li>Committing <code>wp-config.php</code>, and with it your database password and salts.</li>
<li>Putting <code>wp-content/uploads</code> in the repo, then wondering why clones take ten minutes.</li>
<li>Pushing a staging database over production because &#8220;the content is the same&#8221;. It never is.</li>
<li>Using <code>sed</code> or SQL to swap URLs instead of <code>wp search-replace</code>.</li>
<li>Replacing the <code>guid</code> column, and re-sending your archive to every RSS subscriber.</li>
<li>Running <code>rsync --delete</code> against production without testing the exclude list.</li>
<li>Leaving updates enabled in wp-admin, so the repo and the server drift apart silently.</li>
<li>Disabling automatic updates without putting a review process in its place.</li>
<li>Restoring production data onto staging with mail still enabled.</li>
<li>Forgetting <code>DISABLE_WP_CRON</code> on staging, so scheduled jobs fire twice across two environments.</li>
<li>Treating &#8220;the files copied&#8221; as proof the deploy worked, with no smoke test.</li>
</ul>



<h2 class="wp-block-heading">Best practices</h2>



<ul class="wp-block-list">
<li>Make the repo the only way code reaches a server, and enforce it with <code>DISALLOW_FILE_MODS</code>.</li>
<li>Keep code moving forward and content moving backward, and state that rule where the team can see it.</li>
<li>Deploy staging from a branch and production from a tag, so production releases are deliberate.</li>
<li>Dry-run every search-replace and every rsync the first time.</li>
<li>Back up the target database immediately before any deploy that touches it.</li>
<li>Script the staging restore end to end, including mail, cron, keys and anonymisation.</li>
<li>Finish every deploy with a real HTTP request through the public URL, not a file listing.</li>
<li>Use environment-aware code with <code>wp_get_environment_type()</code> instead of commented-out blocks.</li>
<li>Keep uploads out of git and sync or offload them separately.</li>
<li>Replace automatic updates with a scheduled dependency review, and put it in a calendar.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">FAQ</h2>



<h3 class="wp-block-heading">Should WordPress core be in the repository?</h3>



<p class="wp-block-paragraph">Only if you are not managing it another way. Committing core works and makes the repo self-contained, at the cost of noisy diffs on every update. Declaring core as a Composer dependency is cleaner and gives you a pinned version without the noise. What you should not do is leave core unmanaged, so nobody can say which version production runs.</p>



<h3 class="wp-block-heading">How do I handle the database in a Git workflow?</h3>



<p class="wp-block-paragraph">You do not put it in Git. Git handles code; the database is handled by scripted pulls in one direction. Production to staging to local, with a search-replace on import. The only time a database legitimately goes upward is the initial launch, before there is real content to lose.</p>



<h3 class="wp-block-heading">What about plugin settings changed in staging?</h3>



<p class="wp-block-paragraph">This is the genuinely hard part and there is no clean answer. Settings live in the database, so they do not deploy. Options are: reapply them by hand in production with a documented checklist, script them as WP-CLI commands in a deploy step, or use a plugin that exports configuration to files. Whichever you pick, write it down, because &#8220;I&#8217;ll remember&#8221; is how a setting gets applied to staging and never production.</p>



<h3 class="wp-block-heading">Is Bedrock necessary?</h3>



<p class="wp-block-paragraph">No. It is a well-made set of defaults for Composer-managed WordPress with environment-based configuration, and it saves assembling those pieces yourself. Plenty of teams run a perfectly disciplined Git deployment with a standard directory layout. Adopt it if you want the conventions; do not adopt it as a prerequisite.</p>



<h3 class="wp-block-heading">Do I need three environments?</h3>



<p class="wp-block-paragraph">You need local and production. Staging earns its cost when you have multiple people, a client who signs off on changes, or a site where breakage costs money. On a personal blog it is overhead. On a store, skipping it means production is your test environment.</p>



<h3 class="wp-block-heading">Can I do this on shared hosting?</h3>



<p class="wp-block-paragraph">Partly. You need SSH and ideally WP-CLI, and plenty of shared plans have neither. Some managed WordPress hosts offer a git push deployment target, which handles the file half for you. If you want the full workflow with your own build steps and post-deploy hooks, a small VPS from a provider like InterServer gives you the SSH access and cron control the workflow assumes.</p>



<h3 class="wp-block-heading">How do I roll back a bad deploy?</h3>



<p class="wp-block-paragraph">Files are easy: redeploy the previous tag, or swap the symlink back if you use atomic releases. The database is the hard part, which is why you take a dump immediately before any deploy that runs a migration. Rolling files back without rolling the database back can leave you worse off than the broken version, so know which of the two actually changed before you act.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">The one thing to remember</h2>



<p class="wp-block-paragraph">Git-based WordPress deployment is not really a pipeline problem. The pipeline is the easy part, and you can build a working one in an afternoon. The hard part is making the repo the only way code reaches a server, and then keeping the database flowing in exactly one direction.</p>



<p class="wp-block-paragraph">Get those two right and everything else is detail. Get them wrong and you will keep having the same confusing morning, staring at a plugin version that nobody remembers changing.</p>



<h2 class="wp-block-heading">Want this set up properly on your site?</h2>



<p class="wp-block-paragraph">Retrofitting version control onto a live WordPress site is fiddly work, mostly because you have to do it without downtime and without losing whatever has been changed directly on the server. Things I take on:</p>



<ul class="wp-block-list">
<li>Moving an existing production site into Git without downtime, including reconciling whatever has drifted on the server.</li>
<li>Converting a site to Composer-managed plugins and core, with a working lockfile and a sane update process.</li>
<li>Building local, staging and production environments that actually match, with per-environment configuration.</li>
<li>Deploy pipelines in GitHub Actions or GitLab CI: build, rsync or atomic releases, post-deploy WP-CLI steps, smoke test, rollback path.</li>
<li>Scripted database refreshes from production to staging with mail, cron, API keys and personal data handled automatically.</li>
<li>Server setup for the workflow: SSH deploy users, correct file ownership, OPcache resets, cron.</li>
</ul>



<p class="wp-block-paragraph">Tell me how your site is hosted and how plugins currently get updated, and I will tell you what the first step should be.</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="https://www.upwork.com/freelancers/~01f15a912ad84a6620" target="_blank" rel="noreferrer noopener">Work with me on Upwork</a></div>
</div>
<p>The post <a href="https://john-nessime.com/blog/devops/git-based-wordpress-deployment/">Two Sources of Truth: Git-Based WordPress Deployment From Local to Production</a> appeared first on <a href="https://john-nessime.com/blog">John Nessime</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://john-nessime.com/blog/devops/git-based-wordpress-deployment/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
