通过phpMyAdmin删除回收站中的所有产品- Woocommerce

s2j5cfk0  于 2022-11-09  发布在  PHP
关注(0)|答案(1)|浏览(229)

我知道如何删除WooCommerce中的所有产品,但我不知道如何删除垃圾中的所有产品。你们中的任何人知道如何删除吗?我已经看过了,我想我有一个想法,但我不想破坏任何东西。
我得到了这个删除所有产品。

DELETE FROM wp__term_relationships WHERE object_id IN (SELECT ID FROM wp__posts WHERE post_type = 'product');

DELETE FROM wp__postmeta WHERE post_id IN (SELECT ID FROM wp__posts WHERE post_type = 'product');

DELETE FROM wp__posts WHERE post_type = 'product';

DELETE FROM wp__posts WHERE post_type = 'product_variation';

先谢谢你。

neskvpey

neskvpey1#

您可以使用下列查询:

DELETE FROM wp_postmeta 
WHERE post_id IN (SELECT ID 
                  FROM wp_posts 
                  WHERE post_status = 'trash' AND post_type IN ('product','product_variation'))

DELETE FROM wp_posts 
WHERE post_status = 'trash' and post_type IN ('product','product_variation')

相关问题