$args = array(\'post_type\' => $post_type,
\'numberposts\' => $numberOfPost,
\'order\' => \'DESC\'
);
$tax_query = array(array(\'taxonomy\' => $taxonomy,
\'field\' => \'slug\',
\'terms\' =>$terms
$args[\'tax_query\'] = $tax_query;
下面是一个示例元查询。如果您还需要元查询,请使用此选项。
$meta_query = array(\'relation\' => \'AND\',
array( \'key\' => $key_here,
\'value\' => $value
),
array( \'key\' => $other_key,
\'value\' => $vaue,
\'compare\' => \'BETWEEN\',
\'type\' => \'NUMERIC\'
)
);
$args[\'meta_query\'] = $meta_query;
现在在WP\\u查询中传递$args
$posts = new WP_Query($args);
如果没有用,请告诉我。