WordPress.org

Ready to get started?Download WordPress

Forums

Changing post author (3 posts)

  1. keaggy
    Member
    Posted 5 years ago #

    I've been the sole poster on an internal blog and now I want multiple people to act as Editors. I've published hundreds of items as an Admin and I want those Editors to be able to edit those posts and pages -- but it seems they can't b/c their role is lower than mine.

    Can I bulk reassign all my posts to another user profile? I know you can do that by deleting a user but this is my Admin account. And I know I can do it one-by-one but that would take a lot of time. And I'd hate to make all those editors Admins. The Role Manager plugin didn't help in this case. Thanks.

  2. haochi
    Member
    Posted 5 years ago #

    You can just update the value of post_author (in wp_posts table) for each post with the person's user id.

    With something like this:

    <?php
    include('wp-config.php');//include WP's wp-config file
    $userID = 2; //the user's ID
    $posts = array(10, 20, 22, 23);//array of post IDs that's going to be assigned to the author with the user ID set in the $userID variable
    for($i=0;$i<count($posts);$i++){
    	mysql_query("UPDATE wp_posts SET post_author = '".$userID."' WHERE ID='".$id."'");
    }
    ?>

    Backup your database first. This is not tested.

  3. keaggy
    Member
    Posted 5 years ago #

    Thanks haochi! I appreciate the suggestion... am still wondering if there's a more automated way.

Topic Closed

This topic has been closed to new replies.

About this Topic