WordPress.org

Ready to get started?Download WordPress

Forums

Need SQL Query for removing authors with zero posts (3 posts)

  1. OperaManiac
    Member
    Posted 3 years ago #

    I have registration open on a blog of mine and there are plenty of accounts created which are not active.

    Looking for a SQL query that can help me get rid of authors with zero posts.

  2. lytle69
    Member
    Posted 3 years ago #

    That's an easy one.

    DELETE FROM blog_users WHERE ID NOT IN (
    SELECT post_author
    FROM blog_posts
    );
    DELETE FROM blog_usermeta WHERE user_id NOT IN (
    SELECT ID
    FROM blog_users
    )

    Change the "blog_" to your table prefix.

  3. OperaManiac
    Member
    Posted 3 years ago #

    is this a single query? can i run directly from phpmyadmin?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.