Uploading media to old posts in WordPress backdates the file location

From the ashes of b2/cafelog

I first started using WordPress in 2003 not long after it had been forked from b2/cafelog. It was version 0.7, before they started using jazz-inspired code names for the releases.

  • There were no pages, only posts. Pages arrived in 2005, version 1.5 Strayhorn.
  • There was no plugin architecture: if you wanted to make changes to the functionality of the application then you had to edit the core files (and re-edit them every time you updated WordPress… which was all done manually, of course). Plugins arrived in 2004, version 1.2 Mingus.
  • There were no themes. Support for that also arrived in 2005, version 1.5 Strayhorn, and was greatly improved in 2010, version 3.0 Thelonious.

The media library was also very basic in those days. You actually had to add the absolute path of the media folder in your b2config.php file, like this: $fileupload_realpath = '/home/example/public_html/images';

Organize media into folders

The media library improved over the years but one thing I never got around to switching on was this one, now found in Settings > Media: “Organize my uploads into month- and year-based folders”. I kind of wish I had now, because I have nearly 3,680 images sitting loose in /wp-content.

As part of my site migration from www.garethjmsaunders.co.uk to www.garethjmsaunders.co.uk/blog I am trying to plan the best way to move all these images into month- and year-based folders. If you have any thoughts please do leave them in the comments.

What I did discover, however, is that if I were to retrospectively upload an image today to the media library, say for a blog post dated 9 August 2007, WordPress will upload it to a directory for the month associated with the post (/wp-content/uploads/2007/08/) and not the month I actually uploaded it (May 2014).

However, the media library filter still lists the file as having been uploaded during May 2014.

According to this support ticket “#10752 Uploading new media to existing posts/pages backdates file location” this is a feature, not a bug. It would be rather nice if you could choose which convention it uses: I’d prefer to be able to filter images according to when the image was used on a post, rather than when I ‘fixed’ the image.

Workaround to get a /blog site on WordPress multisite

The following words are reserved for use by WordPress functions and cannot be used as blog names: page, comments, blog, files, feed

Last month I said that I would soon be redesigning and re-architecting my website, including this blog. It has now begun!

Losing the subdomains

Something I want to do is standardise the URLs used on the site. Once upon a time I had an idea of using subdomains for all my mini-sites, so

  • www.garethjmsaunders.co.uk
  • blueprint.garethjmsaunders.co.uk
  • mahjong.garethjmsaunders.co.uk
  • psion.garethjmsaunders.co.uk

I got as far as setting up my blog on a subdomain and I changed my mind. (Or got lazy, I can’t remember now.) 11 years later I have now decided to bite the bullet and move from www.garethjmsaunders.co.uk to garethjmsaunders.co.uk/blog. It’s potentially going to involve a lot of work (and a little .htaccess wrangling) but it will be worth it in the long run.

WordPress doesn’t like blog sites

My plan was to create a new sub-site called “blog” but when I set up a WordPress multisite installation on my local machine to test how this would all work I encountered an unexpected problem. When you try to create a new site called “blog” WordPress multisite returns this error message:

The following words are reserved for use by WordPress functions and cannot be used as blog names: page, comments, blog, files, feed

Ah!

Workaround

The workaround I worked out, however, is pretty simple:

  1. On the WordPress multisite default site, create a new page called “Blog”, with the URL of ‘/blog’. (On my localhost test site this has a URL of http://garethjmsaunders.shed/blog/.)
  2. In Settings > Reading set the posts page to be your new “Blog” page.
  3. Now import your blog into this site. (I imported it category by category, one at a time as I have a lot of posts.)

Of course, if you want your blog to use a different theme than the rest of the default site pages you will need to use a multiple theme plugin.

WordPress 3.0.1 not publishing scheduled posts

Back in May I published a post about WordPress 2.9 not publishing scheduled posts. Recently I did an automatic update to WordPress 3.0.1 … and guess what: scheduled posting has been broken once again.

I’ll try the method I used before, which was to delete all the core WordPress files and upload them again manually, but in the meantime I found this WordPress plugin has done the job: Missed Scheduled.

By default the plugin is set to run every 15 minutes, but I’ve changed mine to 2 minutes by editing line 12:

define('MISSEDSCHEDULED_DELAY', 2); // Number is in minutes, change it according to your needs

If it turns out that uploading the files manually fixes the issue again I guess I’ll be running manual upgrades in future.

WordPress 2.9 not publishing scheduled posts

On Tuesday night I scheduled a post to publish at 08:30 on Wednesday morning. It didn’t happen. Did it have a broken clock, or something?

So I tried to reschedule it. That would surely wor… No! That didn’t work either.

In fact, no matter what I did I just couldn’t get scheduled posts to publish. I would just get a message in my list of posts saying “Missed Schedule”. It turns out I’m not the only person.

I patiently went through every suggestion offered, and not one of them worked. I updated core files (http.php and cron.php) to no effect. I disabled all my plugins. Still nothing.

Other installations

In the end I installed another instance of WordPress 2.9.2 and the latest beta version of WordPress 3.0 (beta 2) and tested those. And guess what: scheduling worked!

Solution

So my solution was to backup everything (blog files and MySQL database), delete all the old files off the server and re-upload them.

Maybe, I reasoned, after the last automatic upgrade something went amiss. Maybe certain key files weren’t overwritten correctly or indeed uploaded at all.

That did the trick. I kind of wished that I’d tried that first. But you live and learn, I guess.

WordPress upgrade: filling in the missing pieces

Missing piece

Well, where to start?

I’ve been meaning to blog about life for ages but since Reuben and Joshua were born in November 2008 other things took more of a priority.  Things like attending to twin boys, eating, getting enough sleep, and generally trying to muddle through the days.  I’ll likely write more about that in the future.

Simplifying life

Over the last few months I’ve been working at simplifying life as much as possible, and being a good Getting Things Done / Take Back Your Life disciple and disengaging from projects and tasks that I knew I wouldn’t/couldn’t complete or which were no longer priorities.  It’s felt good.

That’s given me more of a focus on the things that I do want to do.  Sorting out my web server was one of those things.

Server upgrade

I suspect that I would have blogged more about it at the time (and I now wish that I had) but I made a promise to myself that I wouldn’t blog again until I’d upgraded my server.  Of course, that took a good few months longer than I had anticipated (doesn’t everything these days?).

In February I moved from Webfusion to Heart Internet, after an abortive attempt to simply upgrade to a better hosting package at Webfusion.  The killer feature that was missing from the Webfusion package was subdomains; I didn’t want to lose my www.garethjmsaunders.co.uk URL that I’d just had printed onto a custom-made laptop skin.

So far my experience of Heart Internet has been excellent.

Upgrade WordPress

The most pressing reason for moving to a better server was to enable me to upgrade WordPress, the software that manages my blog.  My old host had a bunch of really out-of-date features (MySQL 3.2 and PHP4) which just wasn’t enough to run the latest versions of WordPress.  What a relief to be able to upgrade from WordPress version 2.0.11 to the latest version 2.9.

And wow! there have been quite a few changes to WordPress in the interim: the addition of widgets and tags, as well as critical changes to the main API, a much nicer UI, etc.  So many changes in fact that my old theme broke.  So that had to be fixed.

The upgrade was pretty pain-free thanks to WordPress’s infamous 5-minute install and upgrade script.  (I tested it out first, of course, on my localhost machine using XAMPP.)  The only thing that I missed was matching the database character set encoding.  It was set to ISO-8859-1 (Latin-1) rather than UTF-8 (Unicode) so there are still a few odd character combinations on the blog that I need to track down.

Batch categories

WordPress now has tags.  Back it the day it only supported categories so I, like many other WordPress users, created tens of categories to organise what I was writing about.  I had 88 categories.

I found a tremendous plugin called Batch Categories which let me quickly (by which I mean over the course of two days, rather than weeks if I had to edit each post individually) move groups of posts from one category to another, and also add tags to groups of posts.

So I took the easy route of replacing most of the categories I had with tags and rationalising my categories down to nine:

  1. Books
  2. Computer
  3. Family
  4. General
  5. God Project
  6. Mah Jong
  7. Music
  8. Psion
  9. Web

Next …

I’m really keen to redesign my blog theme but I’m going to hang off on that for the time being.  I’ve got a couple of other things that I want to complete first.

CSS framework

The first thing is to complete work on what started as a plugin for the Blueprint CSS framework and which is now turning out to be a combination of different parts of my favourite CSS frameworks.

Website redesign

Once that’s done I’m going to work on a complete reworking of my main website www.garethjmsaunders.co.uk.  The last time I did any serious work on it was, I think, probably around 2003.  The code has a very serious dose of ‘classitis‘.

One of my biggest drivers is the number of emails and telephone calls that I still get for information about and software for the Psion range of PDAs.  I want to create some space for myself by putting a lot more of that information on my site, in a way that it can be found more easily.