WP Apply Timezone

I realised that the timezone on my blog is wrong. It was set to Australian time. I was going to change it, but then I realised that anything I’ve written since I left Australia now has the wrong time.

I looked for an easy way to retrospectively change the timezone on posts, but I couldn’t find anything. So I wrote a little plugin that does just that.

When you install and activate the plugin a new option will appear in the Bulk Actions menu of the Edit Posts screen. The new option is called Apply Timezone. You select posts from the list, then choose Apply Timezone and click Apply. The plugin will then change those posts to the current blog’s timezone. If you want to change them to a different timezone, change the blog’s timezone, apply it retrospectively, then change it back. Easy.

The plugin requires javascript to insert the new option into the menu.

As a slight aside, I highly recommend Otto’s most excellent Automatic Timezone plugin. It allows you to choose your location and then sets the timezone automatically, including adjustments for DST. 🙂

Please backup your database before using this plugin. You can use the WP-DB-Backup plugin.

Get the code here.

4 thoughts on “WP Apply Timezone”

  1. Heh. This sounds exactly like what I did; I moved to America and my WP blog is still set to the Sydney, Australia, timezone.

    As I travel a fair bit and document those travels, what I’d like to be able to do is set the timezone/location for each post. By the sound of your description this isn’t what your plugin does. However, would you know of a plugin that does what I’m looking for?

    Thanks mate.

    1. I don’t know of any plugins. It’s non-trivial to code, but not difficult. I thought I’d try writing something, but an hour later it’s not working and I’m not sure why. I’ll happily send you my code if you’re interested. It’s messy as hell, but I think the concept could work. There seems to be some tweak not working. I might try again at some point.

      1. Ok, figured out the issue, silly priority thing with filters. It seems my code works. I’ll upload to WordPress.org once it’s approved. In the meantime I’ll email you a copy to test.

Leave a Reply

Your email address will not be published. Required fields are marked *