Skip to content

Instantly share code, notes, and snippets.

@quangbahoa
Forked from lukecav/Commands
Created November 13, 2023 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quangbahoa/0104e32ded9f0c003a226d6cfb009cc9 to your computer and use it in GitHub Desktop.
Save quangbahoa/0104e32ded9f0c003a226d6cfb009cc9 to your computer and use it in GitHub Desktop.
Bulk update all product posts in WooCommerce with a post status of publish or draft using a WP-CLI command
# Bulk update all product posts with a post status of publish to draft
wp post list --field=ID --post_type=product --posts_per_page=500 --post_status=publish | xargs wp post update --post_status=draft
# Bulk update all product posts with a post status of draft to publish
wp post list --field=ID --post_type=product --posts_per_page=500 --post_status=draft | xargs wp post update --post_status=publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment