wp-cli icon indicating copy to clipboard operation
wp-cli copied to clipboard

Delete draft products with Wp-CLI

Open limeframe opened this issue 5 years ago • 2 comments

could you please help me with the following? I am trying to delete draft products with the following wp-cli commands

wp post delete $(wp post list --post_status=draft --post_type='product' --user=kostas --format=ids --posts_per_page=10000)

wp post delete $(wp post list --post_status=draft --post_type='product' --user=kostas --format=ids --per_page=10000)

wp post delete $(wp post list --post_status=draft --post_type='product' --user=kostas --format=ids)

wp post delete $(wp wc product list --user=kostas --status=draft --format=ids) --allow-root --force

But every time i get back this -> usage: wp post delete ... [--force] [--defer-term-counting]

Thank you

limeframe avatar Jul 29 '20 09:07 limeframe

Github issues aren't meant for general support, please see https://github.com/wp-cli/wp-cli#support for better options.


Here are a few things to think about in the meantime (I won't follow up here, but if you link to a Slack message or Support Forum post I'll do my best) ::

usage: wp post delete <id>... [--force] [--defer-term-counting]

This suggests that no arguments were passed to wp post delete.

What do your inner commands return when run on their own? For example, what does wp post list --post_status=trash --post_type='product' --user=kostas --format=ids --posts_per_page=10000 get you?

I'm not deeply familiar with WooCommerce, but I would not expect draft products to have a trash post status - can you check if that is correct?

trepmal avatar Jul 29 '20 17:07 trepmal

Github issues aren't meant for general support, please see https://github.com/wp-cli/wp-cli#support for better options.

Here are a few things to think about in the meantime (I won't follow up here, but if you link to a Slack message or Support Forum post I'll do my best) ::

usage: wp post delete <id>... [--force] [--defer-term-counting]

This suggests that no arguments were passed to wp post delete.

What do your inner commands return when run on their own? For example, what does wp post list --post_status=trash --post_type='product' --user=kostas --format=ids --posts_per_page=10000 get you?

I'm not deeply familiar with WooCommerce, but I would not expect draft products to have a trash post status - can you check if that is correct?

Sorry bad typing (i just correct my post)

limeframe avatar Jul 29 '20 18:07 limeframe