I am looking for SQL code that I can run from phpmyadmin to remove all registered users on the blog that do not have any post associated with them.
Drop this in a file, name it something like |
|||||||
|
|
The idea is we will get all authors who have some post, and delete user who not in that list! If you're going to use SQL only, run this command on PHPMYADMIN:
If you're going to do in code use this:
|
|||||||
|
|
I don't have ready access to the code, so I don't want to get too specific and quote the wrong functions, but it would probably be a better idea to do it via PHP and MySQL rather than just deleting the records from the wp_users table. If you do it via PHP and use WordPress's built in functions, it will do it cleanly and remove the users without leaving orphaned data in the wp_usermeta table, etc. |
|||
|
protected by Community♦ Jun 3 '11 at 15:36
This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.