In an old WordPress installation I discovered 32,000 spam entries that has been collecting over the years in the Flamingo add on plugin that stores Contact Form 7 entries.
I just wanted to delete everything and start again, from what I read, an uninstall doesn’t remove the entries and there’s no way we can do this manually.
Let’s do it in MySQL Workbench. Backup your DB first, and also I suggest run these as SELECTS first to check what will be deleted, then change the query to delete.
First check all the SPAM entries
SELECT * FROM my_db.wp_postmeta
WHERE wp_postmeta.post_id IN (
SELECT ID FROM my_db.wp_posts
WHERE post_type LIKE 'flamingo_spam'
)
...
SELECT * FROM my_db.wp_posts WHERE post_type LIKE 'flamingo_spam'
then after visual check, delete them
DELETE FROM my_db.wp_postmeta
WHERE wp_postmeta.post_id IN (
SELECT ID FROM my_db.wp_posts
WHERE post_type LIKE 'flamingo_spam'
)
...
DELETE FROM my_db.wp_posts WHERE post_type LIKE 'flamingo_spam'
If you want to remove everything after this, then you can do it in like this (you can do this in one query but I like to be safe and do it one at a time)
Check the meta, and then the posts:
SELECT * FROM my_db.wp_postmeta
WHERE wp_postmeta.post_id IN (
SELECT ID FROM my_db.wp_posts
WHERE post_type LIKE 'flamingo_inbound'
)
...
SELECT * FROM my_db.wp_posts WHERE post_type LIKE 'flamingo_inbound'
Then after you check these, delete them one after another:
DELETE FROM my_db.wp_postmeta
WHERE wp_postmeta.post_id IN (
SELECT ID FROM my_db.wp_posts
WHERE post_type LIKE 'flamingo_inbound'
)
...
DELETE FROM my_db.wp_posts WHERE post_type LIKE 'flamingo_inbound'
After this there’s only the address book entries
First check what you’re going to delete:
SELECT * FROM my_db.wp_postmeta
WHERE wp_postmeta.post_id IN (
SELECT ID FROM my_db.wp_posts
WHERE post_type LIKE 'flamingo_contact'
)
...
SELECT * FROM my_db.wp_posts WHERE post_type LIKE 'flamingo_contact'
Then delete them:
DELETE FROM my_db.wp_postmeta
WHERE wp_postmeta.post_id IN (
SELECT ID FROM my_db.wp_posts
WHERE post_type LIKE 'flamingo_contact'
)
...
DELETE FROM my_db.wp_posts WHERE post_type LIKE 'flamingo_contact'
References:
https://wordpress.org/support/topic/how-to-uninstall-flamingo-plugin/
Comments