二者都get_posts()
和wp_query()
应该能够通过传递tax_query
阵列到其中。
示例:
$query = array(
\'post_type\' => \'portfolio\',
\'post_status\' => \'publish\',
\'posts_per_page\' => -1,
\'tax_query\' => array(
array(
\'taxonomy\' => \'clients\',
\'field\' => \'slug\',
\'terms\' => array( \'acme\' )
)
),
\'orderby\' => \'menu_order\',
\'order\' => \'ASC\'
);
$posts = get_posts( $query );