Skip to content
gilltrish.dev

Working on a production-only WordPress site · Part 2

Fix it, then ship it: getting your local fix onto a live WordPress site

Beginner14 min read

The 30-second version

Your fix works locally, and now it has to go live. Don’t copy the whole site back: the live database has new orders your copy doesn’t. Make a list of exactly which files you changed, get the OK, take a fresh backup, and download the live versions of those files so you can undo. Then upload only the changed files over SFTP with FileZilla during a quiet time, clear the caches, and walk through the bug’s steps on the live site. If anything breaks, put the old files back.

On this page

A while back, another agency asked me to help with a checkout bug on one of their clients’ online shops. They’d been stuck on it for a while, and the site had no staging copy, only the live one. I wasn’t going to test checkout fixes while real customers might be trying to buy something, so I copied the site onto my computer, found the bug and fixed it there.

Then came the part that made my stomach drop a little. The fix worked perfectly on my computer, and not a single customer could see it. It still had to get onto the live site, without breaking the checkout I’d just fixed.

Part 1 covered the first half: copying example-bakery.com onto your computer as example-bakery.local, reproducing the bug and fixing it. This post covers the second half: getting only the fix onto the live site, safely, using SFTP and FileZilla. It’s the same approach I used for that checkout bug.

It’s written for traditional WordPress sites, where the theme and plugins are PHP files sitting on a server. Headless sites deploy differently, so they’re not covered here.

Why this is the scary part

In Part 1 we only read from the live site. Now we’re writing to it, while customers are using it. So the goal is changes that are small, boring and easy to undo.

Deploying is carrying the recipe card, not the kitchen

You tested a new recipe at home and it works. To use it in the shop, you don’t haul your whole home kitchen over and swap it in. You bring the recipe card.

Deploying a fix works the same way. You take the few files you changed and put them on the live site. Everything else stays exactly as it is.

Why you never send your database back

Remember from Part 1: a WordPress site is two things in a trench coat, the files and the database.

Since you made your copy, the live site has kept going. It’s taken new orders, new comments and new sign-ups. Your local database is a photo of the past. Upload it, and everything since that photo disappears.

The rule: code goes up (the theme and plugin files you changed). Content and settings get redone by hand in the live WordPress admin.

Which way should I deploy?

There are three common ways to get files onto a live site:

  • SFTP (what this post uses). Works with any host, and you upload just the files you changed. The risk is uploading to the wrong folder or overwriting the wrong file.
  • Local’s Push (WP Engine sites only). Handy if you pulled the site with Local in Part 1. Under Choose Files you can pick Only Modified Files. But never include the database when pushing to production: it overwrites the whole live database, and WP Engine’s own docs warn against it.
  • Your host’s file manager. Fine for a one-file emergency. Slow for anything more, with no easy way to compare files.

I use SFTP because it works the same on every host, and it’s point and click: the folders on your computer and the folders on the server line up almost exactly, so you can see what’s going where.

Step 1:Write down exactly what changed

Before you upload anything, make a list of every file you touched, written as its path from wp-content, like themes/bakery/functions.php.

Add two more things to the list:

  • Settings you changed in the local admin. Settings live in the database, so they don’t travel with the files. You’ll redo them by hand on the live site.
  • Plugins or themes you updated locally. Don’t upload their folders. Update them through the live admin later, after your backup.

The easiest way to get the list is git. I run git init in wp-content as soon as the local copy is up and running, before I change anything. Then git can tell me exactly what I changed:

Run inside wp-content on your local copy· Shell
# Which files changed, and which are new?
git status

# How much changed in each file
git diff --stat

# The exact lines that changed
git diff

Brand-new files only show up in git status (as “untracked”), not in git diff, so check both. If the terminal still feels scary, this post covers the basics.

No git? Compare your local folder with the original backup. In VS Code, right-click one file and choose Select for Compare, then right-click the other and choose Compare with Selected. WinMerge does the same for whole folders on Windows.

Keep the list in the ticket

Paste the file list and the settings list into the ticket. Future you, or whoever picks the site up next, will want it.

Step 2:Get the OK, compare versions and pick a time

Before changing a client’s live site, I get a yes in writing from the project manager or the client, with a time. I usually send a screen recording of the fix working locally along with it, so everyone has seen the fix before it goes live.

Then compare your local copy with the live site one last time: PHP version, WordPress version, and the active plugins and their versions. If anything doesn’t match, the fix might behave differently live. (Part 1’s versions gotcha shows where to find these.)

Pick a quiet time. Check analytics for when traffic is lowest, and avoid big sales or newsletter sends. For that checkout fix, I waited for a quiet stretch when almost nobody was shopping.

Step 3:Take a fresh backup right before you deploy

Not the one from Part 1. That’s days old now, and it doesn’t have today’s orders. Take a new one the same way as in Part 1, with a description like “Before deploying checkout fix, ticket #123”.

Write the backup’s name and time in the ticket.

SFTP is a locked delivery van for your files

FTP and SFTP do the same job: they move files between your computer and a server. Plain FTP sends everything, passwords included, as readable text, like mailing a postcard. SFTP locks it all up on the way, like a locked delivery van.

Always pick SFTP.

Step 4:Get your SFTP login

You need four things: a host, a port, a username and a password.

On WP Engine: go to Sites, pick the production environment, then open Users and SFTP (you might need to open the Manage menu first) and the SFTP users tab. Create SFTP user adds a new one. WP Engine puts the environment name in front of the username, like examplebakery-developers. The host is the environment name followed by .sftp.wpengine.com, and the port is always 2222.

The password can’t be viewed again after you save it, so put it straight into your password manager.

On other hosts: look in the hosting dashboard for something like FTP accounts or SFTP/SSH. The port is usually 22. If you can’t find it, ask the host’s support.

Where I work, each site has one SFTP login, and the ticket records who actually did the work. That keeps the list of logins short and tidy. Whatever your setup, never paste the password into a ticket or a chat.

Step 5:Connect with FileZilla

FileZilla is free and works on Windows, Mac and Linux. Instead of using Quick Connect, save the site, so you’re not retyping (and mistyping) the details every time:

  1. Open File → Site Manager and click New site.
  2. Set Protocol to SFTP - SSH File Transfer Protocol.
  3. Fill in the host and port, set Logon Type to Normal, and add the username and password.
  4. Name it so you can’t mistake it for anything else, like example-bakery PRODUCTION.
  5. Click Connect.

The first time you connect, FileZilla shows an Unknown host key warning. That’s normal: it’s asking whether you trust this server. Check the host name is right, tick Always trust this host, and click OK. If that warning ever shows up again for the same site, stop and ask the host why.

Two panes, two computers

FileZilla shows two sides. The left side is your computer. The right side is the server. Before you drag anything, open the same folder on both sides:

  • Left: example-bakery/app/public/wp-content/themes/bakery/
  • Right: /wp-content/themes/bakery/

On WP Engine the right side starts at the site’s main folder. On other hosts it might start one level higher, so look for a folder like public_html first.

Step 6:Download the live versions first

This is the step people skip, and it’s the one that saves you. Before uploading anything, download the live copy of every file on your list into a dated folder on your computer, like rollback-2026-11-10. Keep it separate from your local site.

That folder is your undo button. Putting those files back takes seconds, which is much faster than restoring a whole backup.

Then compare each live file with your local version (VS Code’s Compare with Selected works well). The only differences should be your fix. Anything else means the live file changed after you made your copy.

Someone edited the live file after your copy

Another developer, a plugin update, or the client using Appearance → Theme File Editor. If you upload your version, their change silently disappears.

Stop, copy their change into your local file, test again, and then upload.

Step 7:Upload only the changed files

  • Open the matching folder on both sides first. Check the right side really is production: that’s what the clear site name is for.
  • Upload new files before the files that use them. If your fix adds inc/order-form.php and functions.php loads it, upload inc/order-form.php first, so the live site never goes looking for a file that isn’t there yet.
  • Drag single files, not whole folders. Never all of wp-content.
  • Watch the panel at the bottom. Successful transfers should list every file, and Failed transfers should be empty.

I don’t use maintenance mode for this. Uploading a couple of files takes seconds, so I do it during a quiet time instead. The one time I’ve needed maintenance mode was cleaning up a hacked site, and that’s a different post.

Never upload these

  • wp-config.php. Your local one points at your local database. Upload it and the live site goes down instantly.
  • The whole uploads folder. It can overwrite or duplicate the live site’s images.
  • Anything in wp-admin or wp-includes. That’s WordPress itself. Update WordPress through the admin instead.
  • Backups and leftovers: .sql, .zip and .wpress files, debug.log, .git and node_modules.

Overwrite, but only what’s on your list

When a file already exists on the server, FileZilla asks what to do. Choose Overwrite, and leave Always use this action unticked, so you see every file you’re replacing.

Skip Overwrite if source newer. Every file on your laptop looks “newer” because of when you copied the site, not because you changed it.

Step 8:Redo settings changes in the live admin

Work through the settings list from the first step, by hand, in the live WordPress admin.

If the fix needed plugin or theme updates, do them now in Dashboard → Updates, one at a time, checking the site after each one.

Step 9:Clear the caches

If the live site looks unchanged, it’s probably a cache showing the old version. Clear each layer:

  • The caching plugin, if the site has one: purge everything.
  • WP Engine: Sites → your environment → Cache (under Manage) → Clear all caches. That also clears WP Engine’s CDN.
  • A separate CDN like Cloudflare, if the site uses one.
  • Your browser: hard refresh, or open a private window.

Every now and then the server’s own PHP cache (OPcache) keeps running the old file for a minute or two. If it still looks wrong after clearing everything, wait a couple of minutes before you decide the fix failed.

Step 10:Check the live site

  1. The home page loads and looks right.
  2. Follow the steps in the ticket. Is the bug gone?
  3. Check the things around the fix. If you touched the checkout, only place a test order if the client has approved it (and knows to cancel or refund it). Otherwise, check the page loads and works up to the payment step.
  4. Check one or two unrelated pages.
  5. Look for new errors. On WP Engine: Logs (under Advanced) → Error. It only keeps about the last day, so check soon. Tools → Site Health in the WordPress admin is worth a look too.

It’s the same idea as Part 1’s “Check your local copy works” step, now on the real site.

Step 11:If something broke, roll back

First choice: put the old files back. Upload the files from your rollback-… folder the same way you uploaded the fix, and clear the caches again. It takes seconds.

Last resort: restore the backup. WP Engine’s one-click restore puts back all the files, and the database too if you tick Restore with database. Restoring the database loses every order since the backup. There’s no one-click way to restore just a few files: you’d download a partial backup ZIP and upload them yourself, which is exactly why the rollback folder is worth having.

White screen, or “There has been a critical error on this website”? WordPress may email the site’s admin address a recovery mode link, which lets you log in with the broken plugin or theme paused. The link works for 24 hours. On a client site that email usually goes to the client, not you, so don’t wait for it: roll back the files first.

Then go back to your local copy and work out what’s different between it and the live site: versions, active plugins, caching.

What could go wrong

Wrong site, or wrong folder

Uploading to staging instead of production, or into themes/ instead of themes/bakery/. Clear names in the Site Manager, and checking both sides before you drag, prevent most of these.

A half-uploaded file

If the connection drops mid-upload, the live file can end up cut short, and a cut-short PHP file breaks the site. Upload it again, and check the file size on the right matches the left.

It works locally but not live

That’s almost always a difference between the two: the PHP version, a missing PHP extension, file permissions, or a plugin that’s active on one and not the other. It’s why the version check happens before you deploy, not after.

Windows surprises

Windows doesn’t care about capital letters in file names, but most web servers do: there, Header.php and header.php are two different files.

Some editors also add an invisible marker (a BOM) to the start of a file, which makes PHP throw “headers already sent” errors. Save PHP files as UTF-8 without BOM.

It looks like nothing changed

Usually that’s a cache, not a failed fix. Clear every layer before you start debugging.

Parent themes and child themes

A parent theme is a cookbook someone else wrote. When they release a new edition (a theme update), your copy gets swapped for the new one. If you scribbled your fix in the margins, it’s gone.

A child theme is your own notebook that sits next to the cookbook: “use the recipe on page 12, but swap the sugar for honey.” WordPress reads your notebook first, so your changes survive every new edition.

Don’t fix someone else’s theme or plugin in place

If your fix is inside a theme or plugin you didn’t write, the next update wipes it out, often months later when nobody remembers why the bug came back. Put the change in a child theme or a small custom plugin instead.

If the site doesn’t have a child theme yet, switching to one is a change of its own (some theme settings don’t carry over), so test that locally first too.

Step 12:Tidy up

  • Note in the ticket: files changed, settings changed, backup name, and when you deployed.
  • If you made a temporary SFTP login just for this job, delete it.
  • Keep the rollback-… folder for a few days, then delete it.
  • Delete the local copy too. It’s full of real customer data (see Part 1’s customer data gotcha).

What I’d tell past me

Download the live file before you upload yours, every time, and keep it in its own folder. I’ve watched a site lose features it relied on, more than once, because its functions.php got overwritten by an older copy and there was no saved original to compare against or put back.

A ten-second download would have turned each of those into a ten-second fix.

The whole loop

That’s the series. Here’s everything from both parts in one line:

Small, boring and easy to undo

  1. Back up livePart 1: before you touch anything
  2. Copy it locallyFix and test where nobody can see
  3. Back up againRight before you deploy
  4. Save the live filesYour rollback folder
  5. Upload what changedOnly the files on your list
  6. Check and tidy upBug gone, caches cleared, notes made

Next time, it’s worth asking whether the site could have a staging environment: a copy on the host that works like the real thing, so there’s a proper place to test before going live. Many managed hosts include one. Bigger teams also deploy with git instead of dragging files, so every change is tracked automatically. Both are posts for another day.