wordpress批量删除指定无用的垃圾标签 -全讯平台

玩技e族 运维笔记评论90字数 770阅读2分34秒阅读模式

使用场景和用途

1.由于网站之前网站启用了autotags插件,导致乱截取关键词什么a,b,c等等这种单个字母的文字用处不大还占用了tag标签地搜索引擎的影响。因为标签和文章绑定关系所以要多表联查删除。所以有了今天的教程。文章源自玩技e族-https://www.playezu.com/175285.html

查询分类下的文章信息

select id
from wp_posts,wp_term_relationships,wp_term_taxonomy 
where id=object_id 
and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id 
and post_type="post" 
and post_status = "publish" 
and wp_term_relationships.term_taxonomy_id = 393
and taxonomy = "category"

查询指定标签的数量

select *
from wp_terms as a
left join wp_term_taxonomy as c on a.term_id = c.term_id
left join wp_term_relationships as b on b.term_taxonomy_id = c.term_taxonomy_id
where c.taxonomy = 'post_tag' and c.count = 0

删除指定标签的名称(查询条件按数量)

delete a,b,c
from wp_terms as a
left join wp_term_taxonomy as c on a.term_id = c.term_id
left join wp_term_relationships as b on b.term_taxonomy_id = c.term_taxonomy_id
where c.taxonomy = 'post_tag' and c.count = 0
文章源自玩技e族-https://www.playezu.com/175285.html
注意:本文法律责任由该作者承担,侵权请联系▷诈骗举报◁▷新闻不符◁▷我要投稿◁
免责声明:本文内容来自用户上传并发布或网络新闻客户端自媒体,玩技博客仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请联系删除。

发表评论

匿名网友
确定