Created
July 30, 2018 09:00
-
-
Save DriftwoodJP/aa03773151163bcb4440fb69ee344862 to your computer and use it in GitHub Desktop.
To delete all terms, posts & comments in WordPress
This file contains 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
#!/bin/bash | |
# Delete all categories. | |
wp term list category --field=term_id | xargs wp term delete category | |
# Delete all post tags. | |
wp term list post_tag --field=term_id | xargs wp term delete post_tag | |
# Delete all posts. | |
wp post delete --force $(wp post list --format=ids) | |
# Delete all pages. | |
wp post delete --force $(wp post list --post_type='page' --format=ids) | |
# Delete all comments. | |
wp comment delete --force $(wp comment list --format=ids) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment