Troubleshooting, Websites, WordPress

When WordPress Migrations Go Wrong

WordPress is a fantastic CMS with so many plugins and ways to extend the functionality, there’s not much bad to say about it – which goes some way to explain why so many of us are using it to build our own and other’s websites. That said, it’s a technology like any other and sometimes things go wrong. Of course, they only ever go wrong when you least want them to, so here’s a quick summary of the three most common errors that I come up against when moving WordPress sites.

Why would anyone be moving a WordPress site you ask? Well, you might be moving hosts (yes, that can be done!) or you might have been working on a local or development copy so you can test and verify a major update without disrupting the main site. For those of us working away on the backend, moving WordPress sites is just one of those day-to-day things.

But that doesn’t mean it’s foolproof! Three most common issues I see are:

  • Plugin issues causing conflicts, resulting in the illusive error: “The site is experiencing technical difficulties.”
  • Images not being displayed on pages, even when you can see they’re there in the media library and nothing has changed (except for the site having moved, of course.)
  • Redirect errors and stray URLs preventing the site from loading or displaying correctly.
  • Problems with the links in the database or connection info in the wp-config.php file resulting in the “Error Establishing a Database Connection” error.

Let’s address these one-by-one.

Fix the WordPress Error: “The site is experiencing technical difficulties.”

This one, while utterly terrifying (it literally says nothing useful about the issue you are facing) is actually one of the easiest to fix. If you get this error you will often find that you can login to the admin dashboard but not see any of the pages on the site. To test this, type /wp-admin after your domain and see if you can login. Usually you can – which is good because it means the fix I’m about to describe will work.

If you get this error, you need to be able to access the WordPress files on the server OR to be able to access the admin dashboard.

If you can access the dashboard, you need to deactivate all the plugins. Then reactivate them one at a time. Each time you reactivate one, test the site (I usually have this open in a separate tab and refresh the page to see) then continue, adding them one at a time until the site breaks. When you find the offending plugin(s), you can usually resolve the issue by uninstalling then reinstalling the plugin. It’s super easy to do.

Another way – and by far the fastest and easiest (given the number of plugins you could be facing) to deactivate all the plugins is to change the name of the plugins folder, which you can get to via cPanel file manager or via FTP. Just rename it – it doesn’t matter what, but logically “pluginsOFF” or “zplugins” works – then test the site, see if it works (see if you can login to the admin dashboard, if you couldn’t before) then rename it back to plain old “plugins”. Once this is done you do exactly as described above: activate them one at a time ’til you find the culprits, then remove and reinstall them.

Not so bad, eh?

Now for the next one.

Images Don’t Display After WordPress Site Migration

This is one of my favourites; Okay, it’s not, but whenever this happens it always takes me a few minutes to remember how easy and fast the fix is.

First, navigate to Settings and then Permalinks, then change the selection from whatever setting you have (usually Post name) to Plain.

Screenshot of the Permalinks settings page in the WordPress dashboard used to fix a broken wordpress migration
Fixing the Permalinks

Save this setting (scroll down and click the button to save) then change it back to Post name. Check your site (refresh the page or check in an Incognito browser, if you’re not sure it’s refreshing) and many times out of 10 this will have fixed the issue.

But sometimes it won’t! In this case you may well find the issue is some stray links in the database – so onto the next fix.

Fix Redirect Errors and Stray URLs that Stop Your Site Loading or Displaying Correctly

Now you’re into database editing territory, so you might want to call on tech support (via your host) or a friendly techie (like me) to get this part done. But it can be done and it needn’t be terrifying – just as long as you make a backup first.

With your backup in place, login to PhpMyAdmin and find the database you are using for your live website. Then just search EVERY table for the URL you used for your development site (or the old site name if you’ve changed the location of it) and the live site. There are some simple SQL queries to use for changing the URLs, but do remember to try every permutation of the URL you can think off. I once had a problem with a site and found a bunch of old URLs addressing my local installation (localhost), which had long since been deprecated! Work your way through these and you should find you’re on your way to a fully functioning site, unless…

Fix a WordPress “Error Establishing Database Connection” Issue

First up, don’t panic. Despite being monumentally unhelpful this message is also another relatively simple fix. You need to check that your database details in wp-config.php match the details of your actual database and with those two things syncronised, usually you’re good to go.

You’ll find the database name in PhpMyAdmin and the wp-config.php file in your site’s WordPress folder. If in doubt try changing the user password, which you can usually do through MySqlDatabases in cPanel. Make sure your user has full permissions too.

If you get this far and your site still isn’t loading, it’s definitely time to reach out for help, even if the “IT Guy (or Gal)” that comes online to fix it does just one of the four things above and they work (yes, this often happens!)

If you need more detailed explanations for any of the fixes above I can do more step-by-step description, but if you know your way around WordPress this should tell enough to get your site up and running again. I know it’ll be a useful reference for me the next time a site migration goes “pop”!

Troubleshooting, Tools & Tips

A Workaround for the Google Drive Download Error

Store your docs in the Cloud, they say. And we do. And some of us like it so we have multiple accounts. So when we’re using Google Drive to store docs online and then cannot download them, it’s a real pain! The particular error I’m referring to is this one:

Error screen that says: "Access to doc-14-4c.docs.googleusercontent.com was denied. You don't have authorization to view this page. HTTP ERROR 403."
An unhelpful 403 Error when attempting to download files from Google Drive

It’s caused by a conflict between the account containing the files and your default account. For example, your main account is called mainaccount@gmail.com and your files are stored in one of the Drive folders for workaccount@gmail.com. Google doesn’t like you downloading to another account, which is what it thinks is happening.

It’s a problem that’s been around for a while (I found bug reports going back to 2018) but not one Google seem to have fixed. So what to do? Unfortunately, banging your head against the wall will just give you a headache, so lucky for you I’ve already tried that and found a workaround.

Download your Google Drive Files

The workaround to this annoying 403 error is:

Total Time: 5 minutes

Share the folder or file with your default Google account.

Right-click on the file or folder, select Share, then enter the email address for your main account.

Login to Google Drive on your default account.

Click on the list of accounts on the upper-right side of screen. This shows your list. Click on the default account to change to.

From the default account, find the shared file or folder.

Select Shared with Me from the list on the left of the screen.

Download the files.

Right click on the file or folder and select Download.