0

I am using buddypress with wordpress.I accidentally deleted a user directly in data base table wp_users. Therefore just the user only deleted but the posts posted by him remains in the site. How to delete all the posts related to that deleted user. Is there any way?

1
  • Give the table schema of wp_users and posts Commented Dec 27, 2013 at 18:22

1 Answer 1

1

Do it carefully this is the Query to detect all the posts from the deleted user to confirm that, the select query show you the post of the user that are not found in wp_users table.

SELECT *
    FROM `wp_posts`
WHERE `post_author` NOT
    IN (
        SELECT id
           FROM `wp_users`
       )

And this is hows you run the delete query.

DELETE
    FROM `wp_posts`
WHERE `post_author` NOT
    IN (
        SELECT id
           FROM `wp_users`
       )

Run this query in your database.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.