How to Remove "Orphaned" term_relationships
-
Hi,
I discovered a heap of attempted posts in our website from October 2011 forwards, from spam user accounts.
I used SQL to remove most of this, for the sake of speed (there were 60,000+ posts awaiting “moderation” from “contributor” accounts!), and also ran a query I made to remove unused tags.
Everything is down to the most streamlined it can be EXCEPT the term_relationships table, which still references a lot of the posts and tags I have now deleted.
I know that this table simply joins tags/cats to posts, so I also know there will be a good SQL query to delete those which relate to either cats or tags which are not present, or posts which don’t exist.
Just wondering if anyone has the SQL query I’d need for this already – the couple I came up with aren’t working, and my mind is now foggy after working out how to do the rest.
I’ve collected a lot of good SQL snippets over the years, but none for this issue!
The topic ‘How to Remove "Orphaned" term_relationships’ is closed to new replies.