WP-CLI count all CPT

By.

min read

My profile

Share this:
wp-cli post --post_type=attachment list --format=count

For all multisite sites

wp-cli site list --field=url | while IFS= read -r line; do url=$(echo "$line" | awk -F'\t' '{print $1}'); echo ""; echo "";echo $url; echo "";wp-cli --url=${url} post --post_type=attachment list --format=count; done;

Source: https://shortcode.dev/wp-cli/count-all-posts.html

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *