DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Some bloggers makes the mistake to write their first posts under the name “admin”, until they realize that it’s absolutely not personal. But then, modifying author attribution on each post takes a lot of time. Happilly, here’s a recipe to batch modify author attribution.

To achieve this recipe, we’ll use phpmyadmin and the SQL language. As the following commands will modify your WordPress database, don’t forget to create a backup before running any command throught phpmyadmin.

The first thing to do is getting the IDs of WordPress users. Once logged in phpmyadmin, insert the following SQL command:

SELECT ID, display_name FROM wp_users;

Right now, phpmyadmin displayed a list of WordPress users associated with their IDs. Let’s say that NEW_AUTHOR_ID is the ID of the “new” author, and OLD_AUTHOR_ID is the old author ID.

UPDATE wp_posts SET post_author=NEW_AUTHOR_ID WHERE post_author=OLD_AUTHOR_ID;

That’s all. Once this last command has been run, all posts from the old author now appears to have been written by the new author.

3 Comments

  1. Thanks a lot for this tip. I thought it would be a daunting task to do this for ten thousand plus posts and thousands of authors attributed to automatic posting errors when I updated the structure of my blog, but I automated the task by producing a list of all authors ids and what to change them to in a spread sheet and ran it as a batch. Thanks this saved me a lot of time.

  2. Worked perfectly. If you’re using multisite, you also need to customize the wp_posts to wp_2_posts or wp_3_posts depending on which sub-database you’re using. Thanks so much for this. As Brad said, saved a lot of time!

  3. A slight improvement to avoid changing “too much” is to specify that you only want to rename Authors for OPEN pages, as opposed to everything including TRASH items:

    UPDATE wp_posts SET post_author=NEW_AUTHOR_ID WHERE post_author=OLD_AUTHOR_ID AND post_status = ‘OPEN’

Leave a Comment

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