This blog has been running 17 years, and a good 14 of those the blog has been powered by WordPress. But in that time not only how I write has changed, but the way WordPress organises everything has changed a fair bit too. Back in 2008 I was coding the HTML to make sure images in posts were formatted correctly – now that’s all handled by WordPress and the settings of my theme.
And while we’re on that point, the blog has gone through at least 5 theme revisions in its time as well.
So all of that meant that not only was there a lot of content to sort out when I wanted to split off my transport posts onto a separate site (jonworth.eu) and retain the rest of the content and format here at Euroblog with a new URL (euroblog.jonworth.eu), but also plenty of legacy HTML and legacy image files and thumbnails uploaded over the years.
Just in case anyone ever needs to attempt similar, here is what I did to get everything orderly. Through a process of trial and error I concluded it makes most sense to do these steps in the order I outline here.
Before starting any of this, backup all your WordPress files (especially the wp-content directory) and all your MySQL databases (1 per WordPress site normally)
2. Bulk Media Register plugin
The free Bulk Media Register plugin scans your wp-content/uploads directory for any image files that are not also listed in the Media library in WordPress. Orphaned files if you like. This can happen if files were uploaded to wp-content before the Media library function was even added to WordPress, or if files were somehow incorrectly migrated from another installation. Before using this one be sure to check the Settings tab, and list directories within wp-content/uploads you do not want the plugin to scan – I had some old theme files in there (hell knows how!) that the plugin was trying to scan. Anyway, once you have the settings right, use the Bulk Register function – it will make sure all image files are correctly referenced in your Media library. Once you’re done with this one you can un-install it.
3. Media Deduper plugin
Now you need to weed out the duplicates in the Media library – the free Media Deduper plugin can do this for you. It can make sure that you do not have multiple copies of the same file in your Media library. Here too this can be uninstalled after use.
4. Media Cleaner plugin
But what about files that are in your Media library, but actually are not used in any Posts or Pages in WordPress? You might want to get rid of those to save yourself some disk space. Here the free Media Cleaner plugin is the tool to use – it will highlight entries in Media library that are not used in Posts or Pages. Before definitively deleting the files it moves them to wp-content/uploads/wpmc-trash – you can then download these files before then removing them from the server – handy just in case Media Cleaner makes an error somewhere. Media Cleaner helped me delete 4Gb of image files no longer needed on this blog – handy! Uninstall this after you have used it.
5. Imsanity plugin
The free Imsanity plugin helps you make sure the files you upload in WordPress are no larger than they need be. By default images from SLR cameras or even decent mobile phones can be 6000 x 4000 pixels resolution – far more than you need for a website! So I have Imsanity set to scale images down to maximum 2048 pixels when an image is uploaded, to save on disk space and help improve page loading speed. And you can get Imsanity to re-size your images retrospectively. This one you want to keep installed – to make sure you keep the size of future uploads in check. Note that Imsanity defaults to 1920 pixels – I have increased this a bit to 2048 pixels, the default Large image size from Flickr.
6. Regenerate Thumbnails plugin
If you have ever changed your theme, the thumbnail sizes you need have probably also changed. The free Regenerate Thumbnails plugin fixes this – it can generate the correct size plugins from all your old images so as to match the new theme. It can also delete old wrongly sized thumbnails as well, but this can result in broken links (see below for a fix). This plugin might be worth keeping installed longer term – you can use it to regenerate thumbnails if cropping or editing images did not result in thumbnails being correctly cropped.
7. Auto Featured Image plugin
This plugin you only need if you have switched themes from one that does not use Featured Images to one that does. The free Auto Featured Image plugin will take the first regular image in a post, and set that as a Featured Image, in a one-off process. You might need to subsequently check some of these manually, but it is a massive time saver if you have a large site. Once you have done this you once you can uninstall the plugin.
8. Broken Link Checker plugin
Some of the steps above can result in you having broken links – especially broken links to images – in your site. Here the free Broken Link Checker plugin can help. It scans your site for broken links, and highlights what the reason was for the broken link, and gives you speedy options to resolve the problem. It also checks for broken links to URLs on other websites, and allows you to replace these with links to the Wayback Machine. The headache for some users with this plugin is that it steadily scans your site – over a number of days – so you are supposed to leave it running, and check back periodically. However this might be more than you need, longer term. But for a week or two at the start, leave it running – and correct your broken links as and when they crop up.
9. Redirection plugin
Useful to have in any case if you’ve ever changed your Permalink structure in your blog – either for the blog as a whole or the slug for an individual post – the free Redirection plugin ought to be installed permanently. It allows you to setup redirects to prevent broken links – that might have been caused through some of the steps above.
Oh, and as I speak some of these processes are still ongoing on some of my sites. So – for now anyway! – please don’t go “oooh he missed one!” Chances are I will find it!