删除具有0个视图的wordpress帖子[wp_postviews插件]

|| 我认为这种选择非常完美...有什么建议吗?
SELECT * 
FROM  `wp_posts` ,  `wp_postmeta` 
WHERE  `post_type` =  \'post\'
AND post_id = ID
AND DATEDIFF( NOW( ) ,  `post_date` ) >400
AND meta_key =  \"views\"
AND meta_value =0;
问题是我不知道如何删除所有这些帖子!有帮助吗? 谢谢     
已邀请:
[评论后编辑-未经测试,因此可能不是100%正确]
create table post_ids_to_remove (postid bigint);

insert into post_ids_to_remove (postid) values (
  SELECT post_id
      FROM  `wp_posts` ,  `wp_postmeta` 
      WHERE  `post_type` =  \'post\'
      AND post_id = ID
      AND DATEDIFF( NOW( ) ,  `post_date` ) >400
      AND meta_key =  \"views\"
      AND meta_value =0
)

delete from `wp_postmeta` where post_id in(
      SELECT postid
      FROM  `post_ids_to_remove`
);

delete from `wp_posts` where id in(
      SELECT postid
      FROM  `post_ids_to_remove`
);

drop table post_ids_to_remove;
    
 INSERT into post_ids_to_remove (postid)

 SELECT ID FROM  wp_posts ,  wp_postmeta WHERE wp_posts.post_type = \'post\' AND wp_postmeta.post_id = ID AND wp_postmeta.meta_key = \'views\' AND wp_postmeta.meta_value = 0;

 DELETE from `wp_postmeta` where post_id in(
          SELECT postid
          FROM  `post_ids_to_remove`
    );

 DELETE from `wp_posts` where id in(
          SELECT postid
          FROM  `post_ids_to_remove`
    );

 DROP table post_ids_to_remove;
    

要回复问题请先登录注册