开发者

SQL query to delete all abandoned tags from WordPress database

开发者 https://www.devze.com 2023-02-04 12:59 出处:网络
I used SQL开发者_StackOverflow社区 query to delets more a 1K posts from my WordPress db. Now my db is left with thousands of tags not being used by any post.

I used SQL开发者_StackOverflow社区 query to delets more a 1K posts from my WordPress db. Now my db is left with thousands of tags not being used by any post.

Can someone plese help me with a SQL Query that will delete all tags from the tags table that has no post in the posts table?

Thanks You Neeraj


Something along the lines of:

delete  Tags
where   Id not in
        (
        select TagID
        from   Posts
        where  TagID is not null
        )

Could be more specific if you posted the table definitions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号