Change Post Author/ID on All posts In a Single Pass (MySql)

Here is a small code snippet (MySql query) that will help you change the post author in WordPress. You will need to run this in your database using PHPMyAdmin or command linke. Back up your database before running any of the queries mention bellow. If you tables have a different table prefix make sure that you change the table name wp_posts.

Change from one author to a alternative author.

 UPDATE wp_posts SET post_author='1' WHERE post_author='2';

Change all post to a specific author.

 UPDATE wp_posts SET post_author='1' WHERE 1=1;

You can find the user ID in the user administration area, just click on the user profile. The ID is in the url. It should look like this /wp-admin/user-edit.php?user_id=wp-admin/user-edit.php?user_id=249&…


Leave a Reply

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