WordPress删除重复的自定义字段

WordPress删除重复的自定义字段

把自定义字段修改成你的,执行SQL就行,记得务必先备份数据库

delete from wp_postmeta
where meta_id in (
       select *
       from (
               select meta_id
               from wp_postmeta a
               where a.meta_key = '你的自定义字段'
               and meta_id not in (
                       select min(meta_id)
                       from wp_postmeta b
                       where b.post_id = a.post_id
                       and b.meta_key = '你的自定义字段'
               )
       ) as x
);


分享到 :
相关推荐