• Hello,

    how can I delete users with no posts. I have 79000 users registered, but only approximately 1400 articles. It’s hard to delete them by Users Panel/Menu. It’s there any hack? How can I do that?

    Clean Up Users Plugin for WordPress (DDCleanUpUsers) not working anymore. Also I want to tell you that I have access to phpMyAdmin.

    Please help.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter focusoft

    (@focusoft)

    I see already a post like this but no recommendations or solutions if really working

    www.ads-software.com/support/topic/confirmation-on-how-to-mass-delete-0-post-registered-users?replies=3

    I expect you could do with with a MySQL script which queries the database and deletes users with a 0 post count. I don’t “know” the code for this but it should be quite do-able. I’d certainly test it first incase you make any mistakes..!

    Thread Starter focusoft

    (@focusoft)

    I found the solution:

    BE SURE TO BACK UP YOUR DATABASE FIRST!!

    To select users who have no posts or comments, you can use this:

    ——————————–

    SELECT *
    FROM wp_users
    WHERE ID NOT IN
    (SELECT post_author FROM wp_posts
    UNION SELECT user_id FROM wp_comments)

    ——————————–

    Then, replace ‘SELECT *’ with ‘DELETE’ to actually delete the records.
    You will then have some ‘orphan’ records in wp_usermeta. Select them with this:

    ——————————–

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

    ——————————–

    Then, replace ‘SELECT *’ with ‘DELETE’ to actually delete the records.

    Well, give it a shot, but make sure you have a backup.

    Thread Starter focusoft

    (@focusoft)

    I made a backup. And this working.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to delete users with no posts?’ is closed to new replies.