Like any longterm relation, my blogging platform, WordPress, requires maintenance. In this post I’m going to cover my WordPress Maintenance experience and make some recommendations to others who use or are considering using a self-hosted WordPress installation.
I started my blog in March of 2004 using the Moveable Type self-hosted blogging platform. Six years later (2010) WordPress 3.0 (self-hosted) was released. It was a superior (and an Open Source—read “free”) product. I decided to migrate my blog to WordPress.
A WordPress Newbee
At the time I didn’t know the WordPress backend at all, and I quickly learned it was completely different from Moveable Type. The organizational structure (where things live on the server) is significantly different. This migration introduced a few “issues.” But, since things seemed to work fairly well over all, I always planned to get to those issues someday. Eight years later that day has finally come. May, 2018 – May, 2019 will be the year of WordPress maintenance.
I’ve loved WordPress. I began to understand its very different logic. And, I began playing with the power of plugins that would provide additional functionality and pretty things up a bit. I tried lots and lots of them! I was particularly fond of the Lightbox plugins and Zemanta. They did some very nice things.
WordPress Maintenance: Garbage Collection
But, as with any relationship, things never remain the same. Plugins came and went. For any number of reasons developers would decide to stop supporting a plugin, and within a few WordPress upgrade release cycles, those plugins would stop working. I would delete them.
What I didn’t realize was that sometimes, the plugins were adding new tables of data to my WordPress database. That database grew and grew in size. I have this gut hunch that large database files slow down blog performance/responsiveness. Mine had become enormous!
But what to do? I dare not delete tables from my database. Never delete a table that is at the core of WordPress system functionality. Your blog will be hosed. The risk was just too great. I was too afraid.
I recently got an email from Google that informed me that I had just too many broken links, links that went to nothing. Certainly, with a blog that is 14+ years old, links break. People delete content that once was online but is no more. The link therefore dies. Google doesn’t like broken links. Broken links lower your ranking in search results.
Roll Up Those Sleeves
So, I decided the time has come for me to really get serious with tidying up my blog, cleaning up the mess, hunting down missing content that is buried somewhere on my server, and place it where it actually should go for WordPress to index it properly and use it. And, it was time to learn how to clean out that clogged up database, too.
The Tasks Ahead
So, below is at least a partial list of what I’ll be up to behind the scenes with my WordPress maintenance.
- Fix the image files that are in complete disarray in various folders all over the server. They all need to be added to and thereby organized by the Media Library. And, much to my delight, adding an image to an old post, say from 2004, now actually puts that image in the correct 2004 folder structure in the Media library (the folder appropriate to the original date of the post and not the current date you updated the media for the old post). Adding all of the scattered images to the Media Library will be a huge task.
- The whole SEO thing is another really big deal–finding a satisfactory resolution to all of the dead links.
- Figure out why the date archives permalink do not work. I currently have no idea why. Fix this issue.
- And then there is the issue with my photo galleries, the dead SlideShowPro installation. Around 10,000 photos are in that non-functioning system and additional ones (from our latest trip to New Zealand) are on my Flickr account. Flickr was recently bought by SmugMug, and who knows what they will do with it1 . I need to install all of these photos on my blog using the default galleries in the Media Library. This will be another huge task.
- Almost all of my old posts have Zemanta code garbage in them. That needs to be deleted. The only way I think it can be deleted is by touching every single post to delete it. It’s not identical code on each post. They’re all slightly different; so, I can’t remove them all in one swoop by a “search and replace with nothing” edit of the database. My attempts at writing a GREP to search and replace the code snippets have all been futile, and I have tried!
- None of the old posts have a featured image for the post. That’s especially important with the theme I’ve been using.
- A huge number of the old images that were in posts are no longer there at all. I think they exist someplace on the server but couldn’t be found by the WordPress installation after being migrated from MovableType. Once upon a time an old plugin removed a significant number of the old image links that didn’t work. So now, finding the missing images will be time intensive if possible at all. I don’t know the images’ original file names from the old non functioning links because the links are gone. Therefore, a search of the image files on the server would be useless.
- The database has accrued way too much garbage data: ancient post revisions, old draft posts I decided not to publish, orphaned post metadata, all of the unused data in database tables from plugins long ago deleted, and on and on. I need to learn what tables can be deleted and clean up the garbage from the database tables that remain.
Here I Go
I started with the last thing on the list. My main WP database was almost 130 megabytes in size. For text only data, that’s just ridiculous! Routinely backing it up needlessly consumes bandwidth, server load and disk space. But how to tackle this issue…
Tah Dah: Plugins Garbage Collector
Two plugins to the rescue: Plugins Garbage Collector and WP-Sweep. I started with Plugins Garbage Collector. It identified a large number of old tables no longer in use and indicated the amount of data in each. (It also identifies tables currently in use by plugins, identifies the plugin, and tells you how much data is in the unused table.) It’s UI isn’t pretty, but it’s functional.
I used my phpAdmin panel to remove the old tables and their data. Naturally I did it plugin by plugin to be sure everything still worked. For good measure, I made numerous backups of the database: before starting and after each deletion just in case everything went to hell.
Tah Dah: WP-Sweep
I then used WP-Sweep to clean sweep unnecessary content from the main WordPress database tables. Again, my working theory was that I couldn’t have too many carefully labeled backups between every stage of the process.
My database is now substantially smaller (less than half the size it was when I started), has significantly fewer tables in it, and seems noticeably more responsive to queries. Thus, the blog itself seems more responsive.
I recommend Plugins Garbage Collector and WP-Sweep. And if you use them, I highly recommend a very careful, detailed, and documented backup strategy at every step of the process in case something goes horribly sideways. Everything appeared to work perfectly in my experience.
I’m now querying the database for all of the Zemanta code that plugin added to the over 1,500 posts I used the plugin on while writing. It was an awesome writing tool back in the day. I’m removing the code one post at a time since I can’t figure out how to successfully use wildcards in my code editor. Now I’m down to fewer than 500 posts remaining, and I’m seeing double.
My next goal will be to add my SlideShowPro photo galleries2 as galleries using WordPress’ built in media library management software.
Then, I’ll tackle the SEO issues with any remaining broken links. Following that, I’ll try to add and tag as many old orphaned image files from the ancient MovableType installation into the WordPress media library. The final step will then be to cut my losses with the junk on the server that seems orphaned and just delete it (after backing it up to my hard drive). If anyone has any additional suggestions of better ways to do this, I’m always open to hearing them.
What I’ve Learned
Maintaining a relationship is work, maintaining a relationship with WordPress is no different. After 14+ years of running a blog, the biggest take aways for WordPress maintenance seem to be:
- Travel light! Avoid the plugin bells and whistles that come and go. The core WordPress development community rigorously supports WordPress development. It’s solid. It’s supported. It endures.
- When you can’t resist trying a new plugin, make sure you know if it added any additional tables to your database and which ones they are. You will probably eventually need to delete them.
- If a plugin is adding code to your posts or pages, don’t, simply don’t! Code, especially links, can be later highjacked and used to increase advertising revenues (or worse) for someone other than you using your blog platform and bandwidth without your awareness.
- Pay attention to SEO. Never get as far behind as I have. When you do, cleaning it up seems like an impossible task.
- I do have a handful of third party plugins that I still love, use, and swear by. They are very popular in the WordPress community. They work well and provide important functionality. Maybe one day I’ll write about them.
- Stay on top of blog maintenance. I’m now committing to a toxic cleanup task that may take well over a year!