Created
June 28, 2019 18:07
-
-
Save lukecav/167a0b92a058188f7f759dad859d5225 to your computer and use it in GitHub Desktop.
Remove Tags that Appear in Less than 100 Posts using WP-CLI
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
for x in $(wp term list post_tag --format=ids) ; do count_posts=$(wp rest post list --tags=$x | wc -l | awk '{print $1-1}'); if [ $count_posts -lt 100 ]; then wp term delete post_tag $x; fi; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment