Troubleshooting, WordPress

How to Remove then Update your WordPress Theme

Generally, things go smoothly when you update your WordPress theme, but sometimes they don’t. When this happens the way to fix it is often to completely delete the old theme and then reinstall it using the theme files direct from the developer. This post walks you through this process step-by-step.

There are several ways to remove an old theme: from the Themes menu in the Dashboard, or from the File Manager on the server, of via FTP. In this tutorial, we’ll stay within the WP Dashboard.

  1. Visit the theme developer website and download the files for your chosen theme. These will be available for download as a zip file.
  2. In your WP Dashboard, select Appearance and then Themes.
  3. If you haven’t already changed to a theme that works, do this now as you won’t be able to delete a theme you are using. Choose a “safe” default like Twenty Twenty or Twenty Fifteen.
  4. Find the theme you want to replace and click Theme Details (this flashes up when you hover of the image.)
  5. At the bottom of this page you should see two buttons (Activate and Preview) and a red text link saying Delete. Click Delete.

Now your site is ready to be updated.

  1. Back in the Themes list, click Add New then attach and upload the zip file containing your theme files.
  2. Wait for this to upload (you’ll see a % indicator at the bottom of the screen while it uploads) then Activate the theme.
  3. Check the site again. Is it working?!
Tools & Tips, Troubleshooting, WordPress

Fun and Games with Mixed Content and SSL Errors

Thanks to Google everyone is now familiar with the secure site padlock in the browser address bar. It’s pretty easy to setup thanks to some great tools like Let’s Encrypt (that generates free SSL certificates) and (for WordPress) plugins Really Simple SSL. But it’s not always plain sailing! Sometimes, despite using these tools you get mixed content and SSL errors> There’s plenty of info online about how to find and fix these (again, using plugins) but this is how I was able to repair a site that had just one page layout that was showing as HTTPS in the address bar but still listed as Not Secure.


Finally! I’ve been trying to figure out why a client site, one with no SSL issues (until now) has been showing just one page of the blog as Not Secure. I Googled, backed up the site then tried changing the URL using Elementor Tools (using the http version of the address and changing it to https). Nothing found.

Then I went into the SQL database and ran query on the http version of the site. Nothing found. Hmmm…

Another check on the incredibly handy Why No Padlock site (which should have been my first port of call) and an old non-HTTPS URL, actually to a development copy that I hosted locally, was flagged up for one of the images used on the page.

Next step: check the source for the offending image file.

Next setback: no file with that name is listed in the source.

So back in the SQL database I ran a search on the path of the file and found that there were 107 instances of it in wp_postmeta and another 27 in wp_posts. It’s definitely there!

A quick URL find and replace later using this query and it’s all back to being padlocked and secured.

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'OLD URL', 'NEW URL');

UPDATE wp_posts SET guid = replace(guid, 'OLD URL', 'NEW URL');

UPDATE wp_posts SET post_content = replace(post_content, 'OLD URL', 'NEW URL');

Done!

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.