← Tous les articles

WordPress: updating plugins without breaking your site

A plugin update taking the shop down on a Friday night is a rite of passage nobody needs. Here is the routine we use on the sites we maintain: a staging copy, WP-CLI, one-command rollbacks and selective auto-updates.

WordPress: updating plugins without breaking your site

Key points

  • Update a copy of the site first: most breakages show up within five minutes of clicking around.
  • With WP-CLI, record plugin versions and export the database before touching anything.
  • Let small plugins auto-update and keep manual control over business-critical ones.

Putting updates off because you are afraid of breaking things is understandable, but it is how sites end up running plugins with known vulnerabilities, and how a routine update turns into a risky multi-version jump six months later. The opposite habit, hitting “Update all” on the live site late on a Friday, is how you meet the critical error screen. There is a calm middle ground, and it is the routine we follow on every site we maintain.

A staging copy, however simple

You do not need heavy infrastructure. A password-protected copy on a subdomain is enough. Apply the updates there, then walk through the journeys that matter for the business: contact form, add to cart, checkout in test mode, customer login, language switcher.

In our experience most problems surface in those few minutes: a JavaScript conflict that disables the buy button, a child-theme template that went stale after a WooCommerce release, a page builder that changed its markup. Check the PHP error log on the copy too; some warnings have no visible effect yet but point to an incompatibility that will bite later.

The command-line routine

WP-CLI makes the process repeatable. Before updating, export the database and save the list of installed versions. That small CSV file is what makes a rollback quick instead of a guessing game.

# What is waiting to be updated?
wp plugin list --update=available --fields=name,version,update_version

# Safety net: database dump + note of current versions
wp db export backups/avant-maj-$(date +%F).sql
wp plugin list --fields=name,version --format=csv > backups/versions-$(date +%F).csv

# See what would change, then update one plugin at a time
wp plugin update --all --dry-run
wp plugin update woocommerce

Updating one plugin at a time feels slower, but when something breaks you know exactly which one did it. For major releases of WooCommerce, page builders or multilingual plugins, read the changelog first: database migrations are usually announced there.

Rolling back with one command

If an update misbehaves in production, there is no need to restore the whole site. Reinstall the previous version of that plugin, the one recorded in your CSV.

# Roll back a single plugin to the version noted in the CSV
wp plugin install woocommerce --version=9.3.3 --force

# Check that core files have not been altered
wp core verify-checksums
wp plugin verify-checksums --all

One caveat: if the new version migrated database tables, the old version may not understand them anymore. That is when the SQL export taken just before comes in, and why the backup step is never optional.

Selective automatic updates

Doing everything by hand does not scale. We let small plugins (SEO, utilities, security) update on their own and keep manual control over anything touching payments or site structure, using a filter in a must-use plugin.

// mu-plugins/auto-updates.php
// Minor plugins update themselves, critical ones stay manual.
add_filter( 'auto_update_plugin', function ( $update, $item ) {
    $manual = array( 'woocommerce', 'woocommerce-payments', 'polylang' );

    if ( isset( $item->slug ) && in_array( $item->slug, $manual, true ) ) {
        return false;
    }

    return true;
}, 10, 2 );

Minor WordPress core security releases are applied automatically by default. Leave that on; those releases are designed to be safe.

FAQ

How often should I update?

A regular pass every week or two works for most sites. A disclosed vulnerability in a plugin you run is a different story: update that one the same day.

What if I cannot use WP-CLI?

The principle is the same: full backup, one plugin at a time, then check the key journeys. The WP Rollback plugin can reinstall an older version from the dashboard.

Tired of holding your breath at every update? Our WordPress maintenance plans include a staging site, tested backups and supervised updates.

Partager LinkedIn Facebook X WhatsApp
</>

webtestudio

Agence web : sites WordPress sur mesure, thèmes premium et logiciels SaaS.

Parler de votre projet →