Advertisement
Evengar

Untitled

Jan 25th, 2017
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.81 KB | None | 0 0
  1. DELETE p FROM wp_posts p WHERE p.post_type = 'product';
  2.  
  3. DELETE pm FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;
  4.  
  5. DELETE tr FROM wp_term_relationships tr INNER JOIN wp_term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.taxonomy != 'link_category' AND tr.object_id NOT IN ( SELECT ID FROM wp_posts );
  6.  
  7. DELETE o FROM `wp_posts` o
  8. LEFT OUTER JOIN `wp_posts` r
  9. ON o.post_parent = r.ID
  10. WHERE r.id IS null AND o.post_type = 'product_variation';
  11.  
  12.  
  13. DELETE p FROM wp_posts p WHERE p.post_type = 'product';
  14.  
  15. DELETE pm FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;
  16.  
  17. DELETE tr FROM wp_term_relationships tr INNER JOIN wp_term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.taxonomy != 'link_category' AND tr.object_id NOT IN ( SELECT ID FROM wp_posts );
  18.  
  19. DELETE o FROM `wp_posts` o
  20. LEFT OUTER JOIN `wp_posts` r
  21. ON o.post_parent = r.ID
  22. WHERE r.id IS null AND o.post_type = 'product_variation';
  23.  
  24. DELETE a,c FROM wp_terms AS a
  25. LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id
  26. LEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id
  27. WHERE c.taxonomy = 'product_tag';
  28.  
  29. DELETE a,c FROM wp_terms AS a
  30. LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id
  31. LEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id
  32. WHERE c.taxonomy = 'product_cat';
  33.  
  34.  
  35. DELETE a,c FROM wp_terms AS a
  36. LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id
  37. LEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id
  38. WHERE c.taxonomy = 'pa_vysota';
  39.  
  40. DELETE a,c FROM wp_terms AS a
  41. LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id
  42. LEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id
  43. WHERE c.taxonomy = 'pa_razmer';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement