WordPress.org

Ready to get started?Download WordPress

Forums

edit / change author attribution on many posts at once? (16 posts)

  1. storyfirst
    Member
    Posted 6 years ago #

    I have looked everywhere I could think of, without luck. So I'm hoping someone here can tell me if there's a way to do this, or maybe there's a plugin.

    What's the quickest, easiest way to change the author attribution on a group of say 30 posts? I can isolate the posts by tag or category, but then as far as I can see, I have to open every one of them in an edit screen, change the author, and save.

    If there's a quicker way to do this that I've missed, please let me know, as I have to do a lot of it, not just one go.

    Thanks for whatever help you can provide.

  2. storyfirst
    Member
    Posted 6 years ago #

    It seems to me that I remember a plugin for mass editing posts, but i can't locate it. If you know of any plugin like that at all, please speak up.

  3. fragmentist
    Member
    Posted 6 years ago #

    I am also interested in an answer to this question. It seems like there should be a plugin for this, though I haven't been able to find one. Thank you to anyone who may know the answer.

  4. loadsapix@gmail.com
    Member
    Posted 6 years ago #

    Count me in as being interested as well! :)

  5. ravenheart
    Member
    Posted 6 years ago #

    Aye me too, I need to do this on one of my sites.

  6. A.Faith
    Member
    Posted 6 years ago #

    I subscribe to this thread. I also need to mass edit posts and assign different authors to one of the posts.

  7. lickedone
    Member
    Posted 6 years ago #

    Hey guys, I found this thread and I want to share with you my solution. It is not for beginners, I'm afraid, so be forewarned. This involves using SSH to connect to your host, and this solution may not work with all web hosts. You are also going to need your database name, username, and password, which you can find in the root of your WordPress in the file wp-config.php. At the very top of that file, you'll see some define statements with your DB info.

    The first step is the make sure you have added the new user you want to change your old post's author to. This is done within WordPress Admin > Users.

    Now it's time to SSH into your web host. My favorite SSH client is PuTTY. Once logged in, enter the command (replace DB_USER with the username you found in wp-config.php):

    mysql -u DB_USER -p

    Then, it will ask for your password, so enter the password you found in wp-config.php.

    If you have done this correctly you should see a message that says Welcome to the MySQL monitor. along with some other info, and your command line will change to mysql>. If this hasn't happened, you've either done something wrong, or perhaps your webhost doesn't allow mysql access through SSH.

    OK. Now enter this command to select the correct database (replace DB_NAME with the database name you found in wp-config.php, and don't forget the trailing semicolon!):

    use DB_NAME;

    Now enter this command to show the users of your blog. This could potentially be a problem if you have a lot of users, I don't so it wasn't a problem for me.

    SELECT ID, display_name FROM wp_users;

    This will spit out some info. Take note of the ID of the user you want to change from (in my case it's "admin", and from now on I will refer to the ID as FROM_ID) and the ID of the user you want to change to (in my case it's "Jason", and from now on I will refer to the ID as TO_ID).

    Up until this point, you have not made any changes to your database. But this final step here involves permanently editing your database. Proceed with caution. Backup your DB if you know how or if your web host provides an option to do so. This command will change your post author to your chosen new post author. Remember to replace FROM_ID and TO_ID with the ID's you found in the previous step.

    UPDATE wp_posts SET post_author=FROM_ID WHERE post_author=TO_ID;

    If you've done everything correctly, you should now be able to go to your WordPress and see that all of your authors have been changed!

  8. dylan
    Member
    Posted 5 years ago #

    I'm trying to do something similar. I want to change all the posts in category 5. I want them to be author 2 instead of author 1. Can somebody show me how the SQl would look to make this happen in wordpress 2.6?

    Since post_category is no longer used, this is tricky.

  9. aaron_guitar
    Member
    Posted 5 years ago #

    The fastest way would be to just run queries on your database. In Dylan's case it's a little more complicated, but possible.

    This (my) plugin could help out a bit. The next version I release will allow you to edit multiple posts at once. I know that doesn't help you out right now, but it should speed up things if you don't want to mess with DB queries.

    P.S. If you find it useful, I'd appreciate a vote in the plugin competition.

  10. hallipa
    Member
    Posted 5 years ago #

    This code will bulk-update authors for all posts with a specific author, (e.g. attribute all posts by author 1 to author 2). Keep in mind that it's very rudimentary and you should follow the instructions carefully.

    - copy all the code below into a new file
    - edit the variables in it, as indicated in the instructions in the code
    - save it as a .php file and upload it to the root directory of your blog
    - run it in your Web browser

    Good luck.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <?php
    
    /***** BACK UP YOUR DATABASE BEFORE RUNNING THIS FILE! ****/
    /***** BACK UP YOUR DATABASE BEFORE RUNNING THIS FILE! ****/
    /***** BACK UP YOUR DATABASE BEFORE RUNNING THIS FILE! ****/
    /***** BACK UP YOUR DATABASE BEFORE RUNNING THIS FILE! ****/
    /***** BACK UP YOUR DATABASE BEFORE RUNNING THIS FILE! ****/
    /***** BACK UP YOUR DATABASE BEFORE RUNNING THIS FILE! ****/
    /***** BACK UP YOUR DATABASE BEFORE RUNNING THIS FILE! ****/
    /***** BACK UP YOUR DATABASE BEFORE RUNNING THIS FILE! ****/
    /* Thank you. */
    
    /* THIS PAGE WON'T SHOW ANY WARNING OR CONFIRMATION WHEN YOU RUN IT, JUST A BLANK PAGE. EVERYTHING HAPPENS IN THE BACKGROUND */
    
    /*
    ----------
    HOW TO USE
    ----------
    
    1. Modify the variables below
    2. Upload this file to your blog's root directory
    3. Open your browser and run this file
    
    Once you made sure it did what it needed to do, delete this file off of your server, so it doesn't get executed by mistake by some robot or another user and mess up your authors in the future.
    */
    
    // Enter your database username, pass, hostname and database name below. You can find these at the top of the wp-config.php file in your blog's root directory. 
    
    $username = "";
    $password = "";
    $hostname = "";
    $dbname = "";
    
    // REPLACE 1 WITH THE AUTHOR ID TO BE REPLACED
    $current_author = "1";
    
    // REPLACE 2 WITH THE NEW AUTHOR ID
    $desired_author = "2";
    
    // STOP MODIFYING HERE, UPLOAD AND RUN THIS FILE. GOOD LUCK.
    
    $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
    mysql_select_db($dbname);
    
    mysql_query("UPDATE wp_posts SET post_author='$current_author' WHERE post_author='$desired_author'")
    ?>
    
    </body>
    </html>
  11. Anonymous
    Unregistered
    Posted 5 years ago #

    Thanks hallipa, I just took the sql query from your document and entered it in my database via the phpAdmin area.

    Here's another solution I discovered after the fact:
    Create a new user, make them an admin. Sign in as the new user and then delete the old user. You will then get the following page:

    You have specified these users for deletion:

    * ID #1: (old user)

    What should be done with posts and links owned by this user?

    * Delete all posts and links.
    * Attribute all posts and links to: (choose new user)

  12. lexthoonen
    Member
    Posted 5 years ago #

    I've got exactly the same question as Dylan:

    I want to change all the posts in category 5. I want them to be author 2 instead of author 1. Since post_category is no longer used, this is very tricky.

    I'm fine with sql queries, but don't get the wp_term_relationships and wp_term_taxonomy / posts / categories idea.

    So how to quickly (we're talking over 2000 posts here (imported via rss)) change authors of posts in a specific category.

    Thanks!

  13. lonchbox
    Member
    Posted 5 years ago #

    not a clue yet!? I´m trying to find the way to change an author on a created page.

    HELP!

  14. intricateartist
    Member
    Posted 5 years ago #

    Lickedone - I ran the query - thanks for the instructions! Only thing I found was that it performed opposite the query:

    UPDATE wp_posts SET post_author=FROM_ID WHERE post_author=TO_ID;

    I inverted FROM_ID and TO_ID and now everything is where it should be.

    Thanks again!!

  15. gohlkus
    Member
    Posted 5 years ago #

    2.7 changes everything!

    Now all you have to do is search for posts by an author, bulk-edit them, and change the author -- easy!

    Upgrade today, if you haven't...

  16. venzie
    Member
    Posted 5 years ago #

    Yes, 2.7 has mass edit options. But I cant seem to find how to change authors. There's an option to change category, tags, status, but not authors. Or am I just missing something?

Topic Closed

This topic has been closed to new replies.

About this Topic