好的,在阅读了很多之后,我最终改为“wp\\u query”,这是一个完美的解决方案:
$tax = get_the_terms($id, \'coupon_category\');
$args = array(
\'post_type\' => APP_POST_TYPE,
\'post_status\' => \'publish\',
\'posts_per_page\' => 5,
\'meta_key\' => \'clpr_topcoupon\',
APP_TAX_TAG => \'gutschein\',
\'orderby\' => array(
\'meta_value_num\' => \'DESC\',
\'post_date\' => \'DESC\',
),
\'tax_query\' => array(
\'relation\' => \'AND\',
array(
\'taxonomy\' => \'coupon_category\',
\'field\' => \'slug\',
\'terms\' => $tax[0]->slug,
),
array(
\'taxonomy\' => APP_TAX_STORE,
\'field\' => \'slug\',
\'terms\' => $term->slug,
\'operator\' => \'NOT IN\',
),
),
);
$query = new WP_Query( $args );
while ( $query->have_posts() ) :
$query->the_post();
get_template_part( \'loop\', \'coupon\' );
endwhile;
wp_reset_postdata();