SHARE
TWEET

Mysql Delete All Wp Post

ghiwar May 23rd, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create temporary table `cull` (`post` int);
  2.  
  3. insert into cull select ID from wp_85affce725_posts where post_status = 'publish';
  4.  
  5. delete from wp_85affce725_posts where ID in ( select post from cull );
  6. delete from wp_85affce725_posts where post_parent in ( select post from cull );
  7. -- done with temp table, cleanup metadata
  8. delete from wp_85affce725_postmeta where post_id not in ( select ID from wp_85affce725_posts );
  9. delete from wp_85affce725_comments where comment_post_id not in ( select ID from wp_85affce725_posts );
  10. delete from wp_85affce725_commentmeta where comment_id not in ( select comment_ID from wp_85affce725_comments );
  11. delete from wp_85affce725_term_relationships where object_id not in ( select ID from wp_85affce725_posts );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top