实际上更新wp cli需要使用以下命令删除Woocommerce安装类别的所有产品:
wp post delete $(wp wc product list --category=category_id --user=admin_username) --force
由于Woo每次只允许删除100个产品,因此您可以使用以下选项
bash command to create loops using a step value of 100.for run in {1..2}; do wp post delete $(wp wc product list --category=category_id --user=admin_username) --force; done
此操作在两个步骤中删除200个产品,每个步骤100个产品
for run in {1..3}; do wp post delete $(wp wc product list
--category=category_id --user=admin_username) --force; done
这一个在3个步骤中删除300个产品,每个步骤100个产品
等等