• I have a couple thousand old posts were my admin account is a coauthor (possibly because that was the account that imported them to our WP site). Is there a quick way I can remove that accounts co-authorship from all of those posts through MySQL? Even with Quick Edit one at a time will take forever.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • I too would like to know this. I mainly would like to know where I can find or how to query my database to find specific authors. I’ve looked everywhere I can think of in the DB and can’t find where coauthors are listed.

    I need to change the format of dozens of usernames and when I do this, many of the posts attributed to those coauthors get disconnected somehow. I need to find the old username in my DB and replace them with the new username.

    If not in the DB, is there a function that I can write up that will do this?

    Any help would be appreciated. Thanks!

    @gregcrowe Why not create a new admin user and delete the one in question?

    @jeffsydor-bipc
    Find all guest authors in posts table. *Supply your posts table name.*
    Select * FROM *posts* WHERE post_type LIKE guest-author

    Changing the username, 4 tables to be updated.
    author = ID //is the post_id in the posts table
    slug = display-name-lower-case

    wp_posts
    post_id| post_name
    author | cap-slug

    wp_post_meta
    post_id| meta_key | meta_value
    author | cap-user_login | slug

    wp_terms (update both name and slug values)
    term_id| name | slug
    author | slug | cap-slug

    wp_term_taxonomy
    term_id| description
    author | %slug% (word match in string)

    Once done with edits. Clear permalink cache.
    Go to Admin > Settings > Permalink and just click ‘Save Changes’.

    There’s another way to do this, but it requires some programming.

    You can run a script that cycles through the posts you want to reassign.
    For each post, you can get the co-authors.
    Then, you can filter out the undesired co-authors.
    Then, you can reassign the co-authors for the post in question.

    The essence:

    global $coauthors_plus;
    $coauthors_plus->add_coauthors(get_the_ID(), $new_coauthors);

    Where $new_coauthors is an array of $u->user_nicename, with $u = get_userdata($coauthor->ID);

    This is all very shorthand, but it should get you going.

    (Adding a message to get notified of updates.)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Delete A Co-Author in MySQL’ is closed to new replies.