Skip to content

Instantly share code, notes, and snippets.

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 thegulshankumar/5545500390948b2de74e60d127755bfc to your computer and use it in GitHub Desktop.
Save thegulshankumar/5545500390948b2de74e60d127755bfc to your computer and use it in GitHub Desktop.
Bulk Migrate All Published Posts to Draft Status via WP CLI
wp post list --post_type=post --format=ids --allow-root | xargs wp post update --post_status=draft --allow-root
or
wp post update $(wp post list --post_type=post --format=ids --allow-root) --post_status=draft --allow-root
@thegulshankumar
Copy link
Author

Enable comment in Bulk

wp post update $(wp post list --post_type=post --orderby=date --order=DESC --format=ids --allow-root) --comment_status=open --allow-root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment