February 8th, 2011

If you have to move a large site witha number of hierarchical categories from one WordPress installation to another, you may come across a problem we at Substrakt have faced quite a few times.

WordPress deals with hierarchical taxonomies like categories in a strange way. It not only stores the categories in the relevant taxonomy tables, along with parent IDs, it also stores an array of those parent-child relationships in the wp_options table.

The upshot of this is that, if you import a blog and you find that not all of the categories you've imported are appearing, fear not, chances are they've imported just fine, it's just that the category_children option within wp_options hasn't been updated.

When you setup a new site, you'll probably find the value of this option is something like “a:0:{}”. Problem with that is that WordPress recognises that it's an array of options, so doesn't bother to correct it. If however, you clear that value out of your database - using something like phpMyAdmin or the below SQL statement - you should find the next time you get a list of categories, the hierarchy will be displayed correct.

UPDATE wp_options SET option_value = '' WHERE option_name = 'category_children';

This happens because WordPress first checks to see if that value is an array. If it is, as I've mentioned, it'll take the value as read. If not - ie: if the value of that option is blank - it will rebuild the tree and resave the value. The next time you look at that value in your database, you should find something a bit more verbose.

Hope that helps. And if you're having any WordPress issues at all, get in touch with us and we'll see if we can help.

January 28th, 2011

I was turned onto this by Jim, our Creative Director, and thought I'd flag it up as it's quite a neat little time saver.

If you need to convey a web concept quickly and simply to a client, download and install Dropbox - the free and really easy way to sync files between computers and access them on your mobile - and put your web files (HTML, CSS, JavaScript and images) into the Public folder of your new Dropbox. Right-click your HTML file, go to the Dropbox menu and click Copy Public Link. Paste the URL into an email, and you're done.

You can also create a folder inside your Public directory and move yoru files there, thus giving you the ability to stage multiple mockups. For example, any files in your Public folder are accessed via a URL like http://dl.dropbox.com/u/12345/foo.html. Create a subfolder inside Public, and it becomes http://dl.dropbox.com/u/12345/bar/foo.html.

Great if you're working on a few mockups and you need to show a client an idea quickly, as there's no FTPing, no logging in with passwords, and vertually nil possibility of others stumbling across it, as those addresses aren't published anywhere except in your account.