我已使用以下查询删除了商店中的所有商品:
^(?:[^\|]*\|){3}([^\|]*) produces 'astring| another string|test|maybe some more text'
然后我跑这是为了删除孤立的postmeta:
DELETE FROM wp_term_relationships WHERE object_id IN
(SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN
('product','product_variation'));
DELETE FROM wp_posts WHERE post_type IN ('product','product_variation');
即使所有产品都被删除,我仍然有与这些类别相关的产品:
我不想删除这些类别(因为它会破坏我建立的网站上的大量菜单)。我只想删除与类别相关的产品。
如何在不弄乱类别本身的情况下做到这一点?
提前谢谢!