Title: Delete inactive users
Last modified: August 30, 2016

---

# Delete inactive users

 *  [teszter](https://wordpress.org/support/users/teszter/)
 * (@teszter)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/)
 * Is there a way to delete all users in bulk (ten tousands) who did not log in 
   in the last 6 months and has no comments?

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [John Parris](https://wordpress.org/support/users/mindctrl/)
 * (@mindctrl)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426902)
 * Here’s a plugin that looks like it’ll do the job: [https://wordpress.org/plugins/inactive-user-deleter/](https://wordpress.org/plugins/inactive-user-deleter/)
 * I recommend making a backup before doing anything with mass deletes. BackWPup
   is a good plugin for that: [https://wordpress.org/plugins/backwpup/](https://wordpress.org/plugins/backwpup/)
 *  Thread Starter [teszter](https://wordpress.org/support/users/teszter/)
 * (@teszter)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426925)
 * Thx, but this is too simple and toooo old to be good 🙂
 * Some sql query magic would be better.
 *  [gioni](https://wordpress.org/support/users/gioni/)
 * (@gioni)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426927)
 * There is a one simple question. How do you know that some user “did not log in
   in the last 6 months”? There is no magic DB query.
 *  Thread Starter [teszter](https://wordpress.org/support/users/teszter/)
 * (@teszter)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426935)
 * I think Buddypress records the last login date, because on the profil page it
   shows “last active: …date”
 *  [gioni](https://wordpress.org/support/users/gioni/)
 * (@gioni)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426949)
 * You asked about Buddypress on the WordPress support forum? 🙂
    Anyway, “last 
   active: …date” means some user made some activity like posting or commenting.
   But this activity doesn’t mean user login/logout. Date takes from date of users
   post or comment. However, you can delete users, which didn’t create any records
   in the posts table.
 *  Thread Starter [teszter](https://wordpress.org/support/users/teszter/)
 * (@teszter)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426953)
 * Since it is a WordPress plugin… nevermind.
 * _“Date takes from date of users post or comment.”_
 * Thx, I didn’t know how that works.
 * I don’t want to delete someone just because they didn’t post anything yet. It
   would affect members who has just registered anyway.
 * I’ve found a way to [record the last login dates](https://wordpress.org/support/topic/capture-users-last-login-datetime?replies=7),
   but now I have to run this code for 6 months ’till I can tell who is inactive…
 *  [gioni](https://wordpress.org/support/users/gioni/)
 * (@gioni)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426957)
 * There is some trick for WP 4.0 or above. Since this version WP adds sessions 
   tokens into the usermeta table when someone logs in to the site. What version
   of WP do you have? How long have you been using it?
 *  Thread Starter [teszter](https://wordpress.org/support/users/teszter/)
 * (@teszter)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426959)
 * _“What version of WP do you have?”_
    Always the latest of course. 🙂
 * _“WP adds sessions tokens into the usermeta table when someone logs in to the
   site”_
    Thx I think this is going to lead somewhere finally… [https://developer.wordpress.org/reference/classes/wp_user_meta_session_tokens/get_sessions/](https://developer.wordpress.org/reference/classes/wp_user_meta_session_tokens/get_sessions/)
 *  [gioni](https://wordpress.org/support/users/gioni/)
 * (@gioni)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426962)
 * You must JOIN wp_users and wp_usermeta table and filter out rows by user_registered
   field with Date you need and plus non exists sessions_tokens in the usermeta 
   table. That will be list of users, which you can kill.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Delete inactive users’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 3 participants
 * Last reply from: [gioni](https://wordpress.org/support/users/gioni/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/delete-inactive-users-3/#post-6426962)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
