• Resolved thelaw

    (@thelaw)


    I have over 30,000 users. It appears that WordPress is extremely inefficient with user handling and I’m trying to delete most of them. Unfortunately it is impossible since even if I turn off the 7 blogs I have, every user pops up a prompt from WP to ask what user you want to attribute posts to. If you try mass deleting more than 10 users the query crawls. Is there a way to mass delete all users that aren’t of a certain level (I’d even mass delete all but certain user IDs)? None of the plugins work. I also realize the mess is compounded by having user account basics and meta information in two different tables. How can you mass delete and remove orphans?

Viewing 6 replies - 1 through 6 (of 6 total)
  • You could do it from the DB itself using phpmyadmin – in the table wp_users you can delete how many users you want.

    Thread Starter thelaw

    (@thelaw)

    What about orphans? I notice that a significant amount of data is in the user_meta table. Always felt this was very inefficient but that’s for another day.

    You can use this query to find orphans.

    SELECT *
    FROM wp_usermeta
    WHERE user_id NOT IN
    (SELECT ID FROM wp_users)

    Then replace “select” with “delete”.

    Be sure to backup your DB before making any change!

    Thread Starter thelaw

    (@thelaw)

    Thanks – I don’t think there will be an easy way. Took me an hour to make sure the user table was pared. Now the usermeta search shows over 1 million entries. Will probably need to perform queries on smaller bits of data… There has to be a better way than this. WP needs to make this more efficient.

    Well,

    just to make it clear – first step is to mass delete the users you don’t want. Then, Run this query – it shows you only the entries that dont have users attached to them, so it should be safe to remove all of them – just replace the “select” with “delete”.

    There is not an easier way, at least not that i know…

    Thread Starter thelaw

    (@thelaw)

    I had to do it the other way around. I ran the query for the users that remained. Saved the table. Then I truncated the entire table and imported the users back. Unfortunately the WP meta user’s table is, IMHO, a total nightmare that has never been properly addressed. Many thanks for the help and confirming that what I saw online would actually work. Scary to perform this kind of surgery otherwise. ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘No way to mass delete users?’ is closed to new replies.