Transferring author information from a custom field to a proper author

A WordPress site I’m doing a redesign for has around 1.400 posts by approximately 30 different authors. Unfortunately the authors of the posts have so far been entered as a custom field within the post, and not as separate authors in WP.

I’d like to transfer this to the ‘proper way’, where each post has an author attached to it, since this would make it possible to display more posts by each author without resorting to plugins like Search Everything.

Read More

Does anybody know of a script that could look through all the posts, search for the custom field containing and author and create that author, and then link the post to that author? (I know, long shot…)

Is that even possible or is there an another way apart from going through 1.400 posts and changing them by hand?

Related posts

Leave a Reply

1 comment

  1. Not knowing your specific setup makes this pretty tricky … but here are some ideas for alternatives that might save you time:

    Leave it as-is

    If these authors aren’t actually users of the site to begin with, don’t change anything. Non-users shouldn’t be turned into users just for the sake of making search easier. Creating so many non-user user accounts will open up just that many potential entry points for malicious visitors.

    Create a taxonomy

    Again, assuming these authors aren’t actually users …

    Create a custom “Authors” taxonomy and dump the author names in there. Taxonomical data is pretty easy to use in a theme to change styling, add attribution, etc. It also gives you archive pages and search functionality so you can index by author name.

    The long way

    If these authors absolutely do need to be turned into users … you’ve got a lot of work ahead of you. I’d recommend sitting down with phpMyAdmin and running some queries:

    1. Run a query to get a list of all author names
    2. For each author name, run a query to see if that author exists
    3. If the author doesn’t exist, run a query to create a dummy use for that author

    Yes, it will take a while … but I’m hoping you don’t have 1,400 different authors for your 1,400 different posts. Your first query should return maybe 100 or so (hopefully you don’t really have 100 different authors!) results … that should definitely save you some time!