1
votes

I've run into what seems like two pretty major limitations of WP's custom taxonomies.

I have an existing blog with hundreds of post. I'd like to retroactively introduce custom post types and taxonomies.

I have a very elaborate (and difficult to use) categorization scheme that should make this easy to do if I could just mass convert posts under a given category to a custom post types or custom taxonomy. (This is because different content types get their own categories [article, video,] as do different taxonomy types [people, places])

I've already created the custom post types and taxonomies that I need using the plugin custom post type ui.

The first step, changing the post type of certain posts, is easy to do by using the convert post types plugin. (It allows you to change the post type of posts under any category, which fits my needs perfectly.)

The second step, converting certain categories to custom taxonomies (say, a set of categories about politicians to a "politicians" custom taxonomy family) is proving to be bloody impossible. There doesn't seem to be a category to custom taxonomy converter plugin out there (the way there is for custom post type conversion,) despite the obvious need for one by anybody looking to to apply WP3.0's CMSing innovations to an already existing blog.

So I've tried going the manual route. If I manually change the "taxonomy" field of different terms in the wp_term_taxonomy table - say, from category to politicians, a custom taxonomy - all posts under that (former) category reflect the update. If you try to edit a post, the custom taxonomy meta-boxes display the right term. (I haven't tried writing a custom loop to see if the posts would display on the site, so I don't know if that works, but I assume it does.) So far, so good. OR SO IT WOULD SEEM:

The first problem is that if you go to the custom taxonomy page (the equivalent of the "category" or "post tags" page under posts,) none of the terms show up in the table at the right. If you SEARCH for them, though, they do show up.

Here is what a skilled WP developer told me when I brought this up:

"I think the problem with updating the db manually is that the post cache doesn’t get changed. (See update_post_caches().) I need to make sure I’m doing that when I change the post types, too."

Unfortunately, I'm not exactly sure what that means or what to do with that.

The second problem is that creating a custom taxonomy and associating it with posts (or any custom post type) doesn't generate a filter box on the view posts page, the way it does for categories. This makes custom taxonomies almost unusable, at least in my case.

So, does anybody have ideas on how to convert categories to custom taxonomies (or at least how to get them to display in the backend if you convert them manually) and how to add a taxonomy filter on the posts page?

Thanks!

4

4 Answers

2
votes

After searching for a while trying to find a plugin to do this, I figured out it can be done easily through the Bulk Post Editor.

I just wrote out the steps to do it on the Blog section on Themespotter.com:

How to Convert Post Tags to Custom Taxonomies in WordPress

1
votes

Checkout this modified category/tag converter plugin http://core.trac.wordpress.org/ticket/16460 which includes custom taxonomies. Its working perfectly for me and a real time saver.

0
votes

There's also some open WordPress support threads about this issue:
http://wordpress.org/support/topic/convert-tags-to-taxonomy-tags

It's such a obvious need, I keep thinking I must be overlooking something basic, but apparently I'm not alone.

0
votes

My solution was to transfer, migrate, convert... tags to multiple custom taxonomies.

After creating custom taxonomies, run SQL query to change value inside of wp_term_taxonomy table under taxonomy column from "post_tag" to a custom taxonomy slug name. You can use patterns to single out tags for each category. For example this code transfers all "standard" tags with "min" inside tag name to "length" custom taxonomy:

UPDATE wp_term_taxonomy SET taxonomy='length' WHERE term_taxonomy_id IN (SELECT term_id FROM wp_terms WHERE slug LIKE '%min')

You can change "wildcards" according to this!

Be sure to backup your database before running any SQL query!