Reputation: 5520
I'm trying to delete users that are older than a certain date in wordpress.
Locally this works (but not on production server where the mysql is newer).
SELECT ID FROM `wp_users` WHERE user_registered < 20131201
The user_registered is a datetime-field. A field could look like this: 2013-12-10 21:20:12
Is this above way it's supposed to be done? Or is there a better solution? I'm asking because I'm getting results that isn't really satisfactory.
Upvotes: 0
Views: 396
Reputation: 472
I think the date format you use is the issue, try this :
SELECT ID FROM `wp_users` WHERE user_registered < '2013-12-01'
Upvotes: 1
Reputation: 10092
DELETE FROM `wp_users` WHERE user_registered < str_to_date('20131201', '%Y/%m/%d')
Upvotes: 0