wordpress中常用sql语句

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:wordpress中常用sql语句

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

开启所有评论
UPDATE wp_posts
SET comment_status = ‘open’
WHERE post_status = ‘publish’;
关闭旧文章的留言
UPDATE wp_posts
SET comment_status = ‘closed’
WHERE post_date < '2009-01-01' AND post_status = 'publish' 删除所有的垃圾评论
DELETE FROM wp_comments
WHERE comment_approved = ‘spam’
删除所有文章修订版本(Revisions)以及它们的Meta数据
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = ‘revision’
清理wp_postmeta表
DELETE FROM wp_postmeta WHERE meta_key = ‘_wp_old_slug’;
DELETE FROM wp_postmeta WHERE meta_key = ‘_revision-control’;
DELETE FROM wp_postmeta WHERE meta_value = ‘{{unknown}}’;
写成shell脚本,添加表优化,可以使用crontab定时调用处理
执行shell

One thought on “wordpress中常用sql语句

发表评论

邮箱地址不会被公开。 必填项已用*标注

6 + 10 =