如书面所示here, 您需要在tax_query
论点
所以,在你的论点中应该是这样的:
$args = array ( \'post_type\' => \'restaurants\', \'tax_query\' => array (array( \'taxonomy\' => \'location\', \'field\' => \'slug\', \'terms\' => \'citya\') ), \'order_by\' => \'title\', \'order\' => \'ASC\' );
如果您只需要查询一个术语,也可以使用简单的方法:
$args = array ( \'post_type\' => \'restaurants\', \'location\' => \'citya\' , \'order_by\' => \'title\', \'order\' => \'ASC\' );