WP-CLI tips and tricks
wp comment delete $(wp comment list --status=trash --format=ids)
wp comment approve $(wp comment list --status=hold --format=ids)
wp comment delete $(wp comment list --status=spam --format=ids)
wp comment spam $(wp comment list --status=hold --format=ids)
seq 1000 2000 | xargs wp media regenerate
wp media regenerate --yes $(wp post list --post_type=page --post_status=publish --format=ids | xargs -d ' ' -I % wp db query 'SELECT meta_value FROM wp_postmeta WHERE post_id=% AND meta_key="_thumbnail_id"' --skip-column-names)
wp media import ~/Pictures/**\/*.jpg
wp media import ~/Pictures/himalaya.jpg --post_id=123 --title="Himalaya range" --featured_image
wp post delete $(wp post list --post_type=custom_css --format=ids)
wp post delete $(wp post list --name=blue-planet --post_type=custom_css --format=ids)
wp post delete $(wp post list --name=$(wp option get stylesheet) --post_type=custom_css --format=ids)
wp option set show_avatars 0
wp option list --search="theme_mods_*" --field=option_name | xargs -I % wp option delete %
wp option list --search="widget_*" --field=option_name | xargs -I % wp option delete %
wp widget delete $(wp widget list wp_inactive_widgets --format=ids)
printf "%s\n" $(wp widget list sidebar-1 --format=ids)|tac | xargs -I % wp widget move % --sidebar-id=sidebar-2