Every developer eventually inherits a WordPress site that nobody has looked after properly for years. I recently took one over: an old theme, years-old page builders, more security plugins than anyone needed, and a core version several major releases behind. Here's how I brought it up to date and closed the security gaps without the site going down.

I didn't build this site, and there was no documentation, no version control and no development copy. Changes had been made directly on the live server for years. That's more common than you'd think, and the steps below should help with any WordPress site in a similar state.

What I inherited

A first, read-only look through the files turned up a long list:

  • WordPress 6.1, with a mix of core files dated 2017, 2020–2022 and 2026, so it had been patched in pieces over the years.
  • A premium theme from around 2016, with its bundled page builders (Cornerstone, WPBakery and Slider Revolution) several years out of date. Content was built with more than one of them.
  • Around 25 plugins, including a cookie banner abandoned since 2017, a database plugin last tested with WordPress 3.0 that had never actually been switched on, and four different plugins doing overlapping login security jobs.
  • Leftovers from previous hosts and tools: an old managed host's settings in wp-config.php, an error log full of warnings from 2017, an old security plugin's quarantine folder, a hosting holding page in the web root and ten unused default themes.
  • A Slider Revolution zip file in the plugins folder that anyone could download.
  • Every user account was an administrator, including several belonging to a previous agency, and the site's admin email went to that agency.
  • No HTTPS redirect. The site worked over HTTPS, but also over plain HTTP, with and without www.
  • A dead analytics tag, still pointing at Universal Analytics, which Google switched off in 2023.

None of it was unusual on its own. Together, it's a fairly typical picture of a site that has worked well enough for years without anyone owning it.

Rule one: don't experiment on the live site

Before changing anything, I built a local copy I could break safely. I used Docker with the official WordPress image, MySQL 8 and Mailpit (a mail catcher), with a few precautions that are worth copying:

  • The dev setup lives outside the site folder. My editor deploys the whole site folder to the server, and I didn't want Docker files ending up on live.
  • A separate wp-config.php is mounted over the real one, so the site's real configuration is never used or changed locally.
  • Outbound HTTP is blocked (WP_HTTP_BLOCK_EXTERNAL) and all email goes to Mailpit. The production database contained live API keys for the email service and the forms plugin, so a dev copy must never be able to send real emails or call real services.
  • Plugins that would misbehave locally are deactivated on import: the firewall, the email service plugin and the login security plugins.
  • The PHP version is a setting, so I could test the same site on PHP 7.4 and 8.2 with one command.

An import script loads a fresh copy of the production database, then runs wp search-replace for every variation of the old URL (HTTP and HTTPS, with and without www). It also replaces JSON-escaped copies such as https:\/\/, which page builders and slider plugins store and a plain search-replace misses.

Put it under version control

Next, I put the site into Git, but carefully. My first commit swept up wp-config.php with the live database password, a security plugin's secrets file, thousands of uploads and log files. Luckily I spotted it before pushing anything. I rewrote the commit, cleared the old copies out of Git's history and checked the password appeared nowhere.

Two lessons. Write your .gitignore before the first commit: secrets, uploads, caches, logs, *.sql, *.zip and editor folders. And on Windows or WSL, set core.autocrlf=false and core.fileMode=false, so the repository stays an exact copy of the server.

Fix what's already broken

Building the dev copy uncovered a live problem: the site's forms had stopped working.

At some point someone had updated Gravity Forms to version 3, which needs a newer WordPress than the site had. It relies on a database placeholder (%i) that only exists from WordPress 6.2, so forms showed "form not found" and threw database errors. Someone had then added a "temporary" fix to the theme that switched off Gravity Forms' merge tags entirely. Forms appeared again, but every notification email went out with no recipient, subject or body, so form notifications had quietly stopped arriving.

Updating WordPress was the real fix, but that was weeks of careful work away. In the meantime, I added a small temporary drop-in (wp-content/db.php) that back-ported the missing placeholder and switched itself off on WordPress 6.2 and later. I removed the theme hack at the same time. Forms and notifications worked again within a day, and the drop-in was deleted once WordPress was updated.

It's a good example of why updating plugins ahead of WordPress itself is risky, and why a "temporary" fix needs a note saying what it breaks.

Close the obvious security gaps

Some fixes didn't need to wait for the big upgrade:

  • A malware scan came back clean, which is good news but not something to assume. I checked for PHP files in uploads, obfuscated code, unexpected drop-ins and must-use plugins, and modified core files.
  • The public plugin zip was deleted and confirmed gone. It wasn't in version control, so no deploy would ever have removed it.
  • HTTPS: one canonical address, with a 301 redirect from every other variant. The rule only applies on the production domain and respects X-Forwarded-Proto to avoid redirect loops behind a proxy.
  • User accounts: the previous agency's accounts were downgraded, staff who only edit content became Editors, and only three administrators remain. The admin email now goes somewhere monitored.
  • Configuration: DISALLOW_FILE_EDIT turns off the theme and plugin editors in wp-admin, and the old host's settings came out.
  • Clutter: the holding page, the unused themes and the old logs were removed.

Then there was the activity log. Its table was 151 MB and 1.6 million rows, almost all failed logins: around 475,000 in five months, from just four IP addresses, trying real usernames. Nobody got in, but it showed exactly why login security mattered. Rather than four overlapping plugins, I standardised on one firewall with two-factor authentication required for administrators. I warned users before removing the old two-factor plugin, so nobody was locked out.

Moving to PHP 8

Moving the live site to PHP 8.2 immediately broke every post and page editing screen. The old theme used create_function(), which was removed in PHP 8. Replacing it with an equivalent anonymous function was a two-line fix.

The lesson was bigger than the fix. I'd tested PHP 8.2 on the dev copy first, but the test that should have opened the editor had failed silently, so I never saw it. Check that your tests actually ran, not just that they didn't report errors.

Two smaller PHP 8 gotchas:

  • OPcache kept serving the old file after the fix, so a restart was needed before the change took effect.
  • The old page builder produced thousands of deprecation notices. With WP_DEBUG on, its error handler printed them into responses and broke the login screen. On a legacy site, switch debug logging on deliberately and briefly, not by default.

Updating WordPress: rehearse it first

Going from WordPress 6.1 to 7.1 in one step on a site this old is where things get interesting. I rehearsed it fully on the dev copy. I backed up the database first and saved the HTML and screenshots of 29 key pages to compare against afterwards.

Two things broke, both because of the old theme:

  • Every request ran out of memory. Two of the theme's functions loaded scripts at a point in WordPress's start-up that newer versions handle differently. The result was an endless loop, using all 512 MB of memory on every page load. Several of those at once were enough to take down my whole local Docker environment. I tracked it down by loading WordPress from the command line with a lower memory limit: core on its own, then with the theme, then adding plugins one at a time. That showed exactly which combination triggered it.
  • The page builder's editor broke with a JavaScript error, because newer WordPress no longer loads a script library the old builder relied on.

Both were fixed in the child theme rather than the parent theme, so they'll survive a future theme update. And they had to go live at the same time as the WordPress update, because the new core without them would crash every page.

Plugins: one at a time, in the right order

Order matters. Some updated plugins required WordPress 6.6 or 7.0, so WordPress had to come first. After that, I updated plugins one at a time:

  • Each one replaced its folder completely (rsync --delete), so files removed upstream didn't linger.
  • After each one, a short smoke test loaded the homepage, a form, a page-builder page, the dashboard and the page editor, one request at a time after the earlier memory crash.
  • Premium plugins came from the vendor's own download or release page, with the file's checksum checked where one was published.
  • For the PDF plugin, I compared a generated PDF before and after the update to check it came out the same.

Plugins that did nothing were removed rather than updated: the never-activated database plugin, a contact-form add-on whose parent plugin had been removed two years earlier, and the extra login security plugins.

Deploying without a staging server

The hosting was a straightforward shared plan: SFTP access, phpMyAdmin and a control panel, but no staging environment. Instead, I used three copies of the site in separate folders on the server: live, a backup and an update copy. The domain was then switched from the live folder to the update folder in the control panel.

This works well, but there are pitfalls:

  • All three folders shared one database. If the updated copy had been loaded even once before the switch, WordPress and several plugins would have run their database upgrades against the live database while the old site was still serving it. So there could be no preview of the update folder before the switch.
  • Absolute paths break when you switch folders. The firewall loads through PHP's auto_prepend_file setting, which held the full path to the old folder. Without changing it, the new site would have quietly kept running the old copy's firewall. I also checked the database for absolute paths.
  • SFTP uploads never delete files on the server. Removing old plugins and core files had to be a separate, deliberate step.
  • WordPress's own maintenance mode wasn't an option, because it needs WordPress's core files in place. Instead, a static holding page was served with a proper 503 status and a Retry-After header from .htaccess, with my own IP address allowed through.

The deployment itself followed a written runbook with four stages: prepare the update folder, a short maintenance window, a verification checklist and the tidy-up afterwards. The window itself was about fifteen minutes:

  1. Turn on the holding page.
  2. Export the database.
  3. Sync any uploads added since the copy was made.
  4. Switch the domain's folder.
  5. Confirm the switch with a marker file.
  6. Log in and run the database update.

The rollback plan was just as simple: point the domain back at the old folder and restore the database export. The old folder is kept for a couple of weeks just in case.

The only surprise after going live was the page builder's editor showing a blank screen until a hard refresh cleared the browser's cached files. That went into the runbook as expected behaviour.

What's left

Not everything belonged in this round. The theme and its bundled page builders need their own project: licensing, a careful content review, and the fact that a theme update would undo the PHP 8 fix in the parent theme. Analytics needs replacing too. Both are written up for the client, along with a before-and-after list of versions and every security change.

Lessons from an inherited site

  1. Never experiment on live. Build a local copy that can't send email or call real services.
  2. Get it into version control, and keep secrets out of the first commit.
  3. Fix what's already broken first, and be suspicious of "temporary" fixes.
  4. Close the quick security gaps early: HTTPS, user roles, public files and overlapping security plugins.
  5. Check that your tests really ran.
  6. Update WordPress before plugins that depend on it, then plugins one at a time.
  7. Fix theme problems in a child theme, and deploy them with the update that needs them.
  8. Plan the deployment around your hosting's limits, with a written runbook and a tested rollback.
  9. Write up what's left, so the next person doesn't inherit the same mystery.

If you've inherited a WordPress site that nobody quite understands any more, I can help with a website health check, security review or ongoing maintenance. Get in touch for a chat.