Last active
November 13, 2023 08:13
-
-
Save lukecav/888537e8d2e1ddbdc71ef70ba4cc5832 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
https://developer.wordpress.org/cli/commands/post/list/
https://developer.wordpress.org/cli/commands/post/update/
https://docs.woocommerce.com/document/installed-taxonomies-post-types/