Migrating from WordPress's "Multiple Authors" plugin to "Co-authors" plugin

Published on

One thing Wordpress lacks support for by default is having entries by multiple authors, yet this is something that happens quite regularly with Nouse. My predecessor sorted this by using the Multiple Authors plugin, but this wasn’t quite the best solution. It required you to type the full name of the user you wanted to add manually into one of the meta fields.

The co-authors plugin appears to solve the same problem, but has a nicer interface (a drop down box in the Write Post screen) and means author archives also include stories they were an additional author on.

Obviously, the database storage between the two varies slightly differently, and we don’t want to lose the metadata from our 4 years of backlog. This simple SQL query will convert posts from the old format to the new format:

INSERT INTO wp_postmeta(post_id,meta_key,meta_value) (SELECT m.post_id,'_coauthor',u.ID FROM wp_postmeta AS m,wp_users AS u WHERE m.meta_key='other_author' AND m.meta_value = u.user_login);