Support » Developing with WordPress » Transfer Custom Post/Media attribution in bulk

  • amateurhr


    I have over 20,000 users on my website (it’s a membership site, not a blogging site). Some of these users have created or uploaded content that needs to survive their departure from the site.

    When I delete a user I am given the option to transfer attribution to another user but then it provides me a dropdown, which I cannot practically use to find another user in the 20,000. When I try to type the first few letters out, they’re not sorted in alpha order so it won’t find the right entry.

    Any idea how I can bulk transfer entries from one username to another?

Viewing 4 replies - 1 through 4 (of 4 total)
  • linux4me2


    If your hosting account has a MySQL UI like phpMyAdmin, you could just run a query something like the following, substituting the user ID of the new post author and old post author for “<new post author ID>” and “<old post author ID>”, respectively, before you delete the user’s account:

    UPDATE wp_posts SET post_author = <new post author ID> WHERE post_author = <old post author ID>

    You’d have to get the user IDs from the Users UI, or you could get it from phpMyAdmin while you’re in there, I guess.

    If this is something you’re doing a lot of, you could also build a little PHP-based UI to run outside of WP to handle it.

    Thread Starter amateurhr


    This says wp_posts, would that cover custom post types, media, and pages?

    Moderator bcworkz


    That’s right, all post types have their principal data stored in wp_posts.

    FWIW, that user dropdown can have which users are displayed altered by a filter hook, but it still would not provide auto-fill functionality like you were hoping.

    Thread Starter amateurhr


    Thank you so much for your help on this!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Transfer Custom Post/Media attribution in bulk’ is closed to new replies.