How to Update WordPress, Plugins and PHP Safely with a Staging Site

Update WordPress safely: back up, clone to a staging site, update plugins, core and PHP there with debug logging on, test, then repeat on live.

To update WordPress safely, back up the site, clone it to a staging copy, run the plugin, core and PHP updates there with error logging on, test, and only then repeat them on the live site.

That is 8 steps, and most of them take minutes. The payoff is that a fatal error or a broken layout shows up on a copy nobody visits, instead of on the homepage your customers and Google see.

⚡ Quick answer

  • Best for: anyone facing a major plugin or page builder update, a WordPress major release, or a host email saying your PHP version is going out of support.
  • Skip staging if: it is a minor security release of WordPress core, which installs itself in the background on most sites anyway.
  • Time needed: one quiet working session, most of it spent clicking through the staging site.
  • Our call: change one thing at a time. Plugins and theme first, then core, then PHP, testing in between, so you always know which change broke what.

What you need before you start

  • An administrator login to WordPress, so you can see Dashboard → Updates and Tools → Site Health.
  • Your hosting control panel. You need it to create staging, change the PHP version and restore backups. If your plan has none of those, our guide on how to choose hosting for WordPress lists what to ask for.
  • SFTP or a file manager, for the day an update leaves the site stuck in maintenance mode.
  • A backup tool that saves both files and the database. Our roundup of WordPress backup plugins compares the free and paid options.
  • Current licences for premium plugins and themes, which usually deliver updates only to an active licence.
  • A quiet weekday window when you can watch the site for a few hours afterwards.

Step 1: Record what the site runs today

Go to Tools → Site Health → Info. It lists your WordPress version, theme, every active plugin with its version, and the PHP version under Server.

Click Copy site info to clipboard and paste it into a text file.

That file is your “before” picture. When a layout breaks two days later, you can see which versions changed instead of guessing.

Then open the Status tab. Its critical issues include “Your site is running an outdated version of PHP” and “You have plugins waiting to be updated”. Note anything flagged.

Step 2: Take a backup you can restore

The WordPress backup handbook says to back up always before an upgrade.

It also recommends keeping 3 to 5 recent backups in different places, such as the server, cloud storage and your own computer.

A WordPress backup has two parts, and you need both to restore:

  • Files: wp-content (plugins, themes, uploads), wp-config.php and .htaccess.
  • Database: posts, pages, settings, users, orders and form entries.

The extended upgrade instructions add one step most people skip: verify the backup is there and usable. Open the archive, check the database file is not zero bytes, and confirm you know where the restore button lives.

⚠️ The catch: a host’s nightly backup is only useful if you can restore it yourself, in minutes, without a support ticket. If you are not sure, take your own backup with a plugin as well.

Backups also cover worse days than a bad update. Our WordPress security hardening checklist covers backup storage alongside the other basics.

Step 3: Create a WordPress staging site

A WordPress staging site is a private copy of your live site, usually on a subdomain, where breaking things costs nothing. There are three realistic ways to get one.

Option A: Your host’s one-click staging

If your control panel has a staging button, start there. Before you rely on it, check three things:

  • Does it copy the whole database, or only files?
  • Is the staging URL password-protected?
  • Can you set its PHP version separately from live?

Option B: A staging or migration plugin

No host tool? A cloning plugin can copy the site to a subfolder or another domain. Our list of WordPress migration plugins covers the main options.

Check before you install whether the free version can push changes back to live, or only clone.

Option C: A throwaway sandbox

For a quick “does this plugin update break anything?” test, a hosted sandbox spins up a disposable WordPress copy without touching your server. Our InstaWP review covers one such service and where its temporary sites stop being useful.

If you clone by hand, the site URL inside the database must change. Use WP-CLI’s search-replace rather than a raw SQL find-and-replace, because WordPress stores some settings as serialized data that a plain replace corrupts. Preview it first:

wp search-replace 'https://example.com' 'https://staging.example.com' --skip-columns=guid --dry-run

Finally, keep search engines out. In Settings → Reading, tick “Discourage search engines from indexing this site”, which adds a noindex tag. It is a request, not a lock, so also put the staging URL behind a password.

Our pick: host staging when it exists, because it runs on the same server stack as live. A clean test on different hardware proves less.

Step 4: Turn on error logging on staging

Updates rarely fail loudly. More often a plugin logs a warning on a page you never open. So, on staging only, send every error to a file.

WordPress developer handbook example wp-config.php settings enabling WP_DEBUG and WP_DEBUG_LOG while disabling WP_DEBUG_DISPLAY
Debug logging settings from the WordPress Advanced Administration Handbook. Source: developer.wordpress.org, captured November 2026.

Add these lines to the staging copy’s wp-config.php, above the line that says “That’s all, stop editing!”:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Errors now land in wp-content/debug.log instead of on the page. The handbook says these tools are meant for local and staging installs, not live sites, and Site Health warns that the log can be publicly readable.

Common mistake: copying this wp-config.php to live when you are done. Remove the lines or set WP_DEBUG back to false.

Step 5: Test plugin and theme updates in batches

WordPress’s own Updating WordPress guide admits there is no single update order that suits every site. Some plugins need updating before core, others need the newer core first. Read the changelog of anything with a big version jump.

Here is the order that keeps each test readable:

  • Batch 1: small utilities such as SEO, caching and forms. Update them, then load the homepage, a post and a form.
  • Batch 2: the heavy ones, one at a time: page builder, WooCommerce or membership plugin, and anything that touches checkout or login.
  • Batch 3: the theme and child theme, then check headers, footers and templates.

Page builders deserve extra care. A major Elementor release can change how existing layouts render, which is why our guide to migrating an Elementor V3 site to V4 safely treats it as a project, not a click.

If you have WP-CLI on staging, preview what would change and keep the risky plugins for later:

wp plugin update --all --dry-run
wp plugin update --all --minor --exclude=woocommerce,elementor

--minor skips major version jumps, and --exclude saves the named plugins for their own test.

After every batch, open wp-content/debug.log. A new “Fatal error” line names the file, and the file path names the plugin.

Step 6: Update WordPress core on staging

With plugins and theme current, go to Dashboard → Updates and click Update Now. WordPress downloads the release, puts the site in maintenance mode for a short time and runs any database upgrade it needs.

The latest release is WordPress 7.1.5 (November 18, 2026). The WordPress.org releases page says only the newest 7.1 version is safe to use and actively maintained, checked November 2026.

Coming from 6.x? Our guide to what changed in WordPress 7.0 covers the features you get on the way.

Two rules from the extended upgrade instructions matter here:

  • More than two major releases behind? Update incrementally rather than in one jump, keeping a working backup between steps.
  • Clear your cache after the update, or visitors and you keep seeing old pages.

On the command line, wp core update does the same job, and wp core update --minor applies only maintenance and security releases.

Step 7: Switch staging to a newer PHP version

PHP is the language WordPress runs on, and each version has a fixed support window. The PHP project supports a branch for two years of active fixes, then two more years of security fixes only, then end of life.

php.net Supported Versions table showing PHP 8.2 to 8.6 with initial release, active support and security support end dates
PHP branches with active and security support end dates. Source: php.net, captured November 2026.

According to php.net’s supported versions page, checked November 2026, PHP 8.3 gets security fixes until 31 Dec 2027, 8.4 until 31 Dec 2028 and 8.5 until 31 Dec 2029. PHP 8.6 shipped on 19 Nov 2026.

So a site still on PHP 8.2 loses security fixes at the end of December 2026. That is the version to move off first.

Next, check what WordPress itself supports. The Core team’s PHP compatibility table marks WordPress 7.0 and 7.1 as compatible with PHP 7.4 through 8.5. PHP 8.6 is not in the table yet.

Make WordPress Core table showing which PHP versions from 7.0 to 8.5 each WordPress version from 6.4 to 7.1 supports
PHP support by WordPress version. Source: make.wordpress.org Core Handbook, captured November 2026.

The WordPress requirements page recommends PHP 8.3 or greater. It still runs on PHP 7.4, but the page warns that end-of-life versions may expose your site to security vulnerabilities.

WordPress.org Requirements page recommending PHP 8.3 or greater, MariaDB 10.11 or MySQL 8.4, and HTTPS
WordPress server recommendations. Source: wordpress.org, captured November 2026.

Our call: move to PHP 8.4 if every plugin you rely on lists it as supported, or 8.3 if one does not. Wait on 8.6 until WordPress lists it as compatible and your key plugins confirm support.

Change PHP for the staging copy only in your hosting panel. Panels that set PHP per domain can only do this when staging lives on its own subdomain.

Then reload staging and read debug.log. “Deprecated” lines are warnings about future versions. “Fatal error” and “Uncaught Error” lines are broken pages today.

Step 8: Test staging, then update the live site

Click through staging logged out, then logged in:

  • Homepage, your busiest pages, a blog post, a category archive and the 404 page.
  • Every form, with a real test submission, and check the email arrives.
  • Login, the editor or page builder, saving a draft and uploading an image.
  • Checkout, account and member pages if you have them.
  • Tools → Site Health → Status, to confirm no new critical issues appeared.

If speed matters to you, run the same page through PageSpeed Insights before and after. Our guide to passing Core Web Vitals in WordPress explains which numbers to compare.

When staging is clean, move to live:

  • Take a fresh backup of live right before you start. The one from Step 2 is already older than your newest content.
  • Repeat the same updates on live, in the same order, or push files only if your staging tool supports that.
  • Switch PHP on live last, then clear every cache layer.
  • Watch debug output through your host’s error log for the next day, since scheduled tasks only run later.

⚠️ Common mistake: pushing the staging database over live. Orders, comments, form entries and users added since you cloned it get overwritten. On a store, push files only or repeat the updates by hand.

Skip the DIY route if the site earns money every hour and nobody on your team can restore a backup under pressure. Our roundup of WordPress maintenance services covers providers that run this routine for you.

How do you check the update worked?

  • Dashboard → Updates says you have the latest version of WordPress, with no plugins or themes listed.
  • Site Health → Info → Server shows the new PHP version, so the panel change really applied to this site.
  • Site Health → Status shows no critical issues, including none about background updates.
  • debug.log on staging has no new fatal errors after a full click-through.
  • A logged-out visit in a private window shows the current design, which confirms the cache was cleared.

Every version that differs from your Step 1 file should be one you meant to change.

What breaks after an update and how do you undo it?

These are the failure patterns to expect, and each has a way back.

What you seeLikely causeHow to undo it
“Briefly unavailable for scheduled maintenance” never goes awayAn update was interrupted and left a .maintenance fileDelete .maintenance from the WordPress root over SFTP, then retry the update
“There has been a critical error on this website”A plugin or theme throws a PHP fatal errorOpen the recovery mode link WordPress emails to the admin address, deactivate the plugin, then roll it back
Layout broken, but no errorPage builder or theme changed its markup or CSSRegenerate the builder’s CSS, clear caches, then roll back the plugin if it persists
“Allowed memory size exhausted” in the logNew version needs more memoryRaise the PHP memory limit, as in our guide to increasing the WordPress memory limit
Errors only after the PHP switchA plugin is not compatible with the new PHP versionSwitch PHP back in the hosting panel, then update or replace that plugin
Maintenance-mode and recovery-mode fixes follow WordPress.org documentation, checked November 2026.

WordPress has some safety nets built in. Since version 6.3, a manual plugin or theme update that fails during install restores the previous version automatically.

Since 6.6, a plugin auto-update that causes a fatal error on the homepage is rolled back and the admin gets an email, per the Rollback Auto-Update proposal.

The catch: neither feature undoes an update that installed cleanly but broke a layout or a checkout. For that, reinstall the previous version. With WP-CLI it is one line:

wp plugin install plugin-slug --version=1.2.3 --force

Still broken? Restore the full backup from the start of the session.

Found files or admin users you do not recognise? Stop updating and follow our guide to cleaning a hacked WordPress site first.

Frequently Asked Questions

What order should I update WordPress, plugins and PHP in?

Update plugins and the theme first, then WordPress core, then PHP, testing after each step. WordPress says no single order suits every site, so read changelogs for big jumps. Changing PHP last means plugins already carry their latest compatibility fixes when the new version arrives.

Do I really need a staging site for every update?

No. Minor WordPress security releases install themselves on most sites, and small plugin updates rarely cause trouble. Use staging for major core releases, page builder or WooCommerce updates, theme updates and every PHP version change, because those are the updates that break layouts and checkouts.

Which PHP version should my WordPress site use?

WordPress recommends PHP 8.3 or greater, and WordPress 7.0 and 7.1 are compatible with PHP 7.4 through 8.5. PHP 8.4 is a sensible target if your plugins support it. PHP 8.2 stops receiving security fixes on 31 December 2026, according to php.net.

Should I turn on automatic updates for WordPress plugins?

Turn them on for simple, well-maintained plugins and keep them off for your page builder, store and membership plugins, which you test on staging. Auto-updates run twice a day, and since WordPress 6.6 a plugin update that causes a fatal error is rolled back automatically.

Will a WordPress staging site hurt my SEO?

Only if search engines can index it as a duplicate of your live site. Tick Discourage search engines in Settings, Reading on the staging copy and put it behind a password. The setting adds a noindex tag, but it is a request, so password protection is the real barrier.

How do I roll back a plugin update that broke my site?

Reinstall the previous version. With WP-CLI, run wp plugin install with the plugin slug, the –version flag and –force. Without it, download the older ZIP from the vendor or the plugin’s Advanced View page on WordPress.org. Treat it as a stopgap; WordPress.org warns old versions may not be secure.

Can updating PHP break my WordPress site?

Yes, if a plugin or theme uses code the new PHP version removed. That is why you switch staging first, with debug logging on, and read the log for fatal errors. If live breaks anyway, switch the PHP version back in your hosting panel and fix the plugin on staging.

Should I push the staging database to my live site?

Usually not. Pushing the whole database replaces everything added on live since you cloned staging, including orders, comments, form entries and new users. Push files only, or repeat the same updates on live in the same order. Database pushes suit brochure sites with no new content.

Which update routine fits your site?

  • Update straight on live if: it is a minor core release or a small plugin update, you have a backup from today, and the site is a simple blog.
  • Use the full staging routine if: the update is a major WordPress release, a page builder, WooCommerce or theme update, or any PHP version change.
  • Hire it out if: the site takes payments and nobody on your team has restored a backup before.
  • Change hosts if: your plan offers no staging, no per-site PHP switch and no restorable backups.

Our pick for most StyleMyWP readers: run Steps 1 to 8 once a month, keep auto-updates on for minor core releases, and pair the routine with a scanner and firewall from our best WordPress security plugins guide.

Last updated November 2026.

Lokesh Kapoor
Lokesh Kapoor

Lokesh Kapoor is a web developer, blogger, and digital creator passionate about WordPress, SaaS, automation, and modern web technologies. He shares practical tutorials, honest insights, and useful resources to help creators, entrepreneurs, and website owners build faster, smarter, and more effective online experiences with confidence, clarity, and consistency.

Articles: 31

Leave a Reply

Your email address will not be published. Required fields are marked *