WP-CLI get all posts from certain post type and taxonomy term

Assume we have a custom post type movie (slug) and a custom taxonomy cast (slug).

1) To find all movies starring Emily Watson, stored with the term slug emily-watson, we can do:

wp post list --post_type=movie --cast=emily-watson

to list all her movies.

2) To find all movies featuring Elizabeth Taylor or Richard Burton , stored with the term slugs elizabeth-taylor and richard-burton, we can do:

wp post list --post_type=movie --cast=elizabeth-taylor,richard-burton

We should at least get Cleopatra (1963) 😉

Leave a Comment