更改WP查询参数,如下所示:
$args = array(
\'post_type\' => \'assignment\',
\'post_status\' => \'publish\',
\'meta_key\' => \'batch\',
\'meta_value\' => \'2017\',
);
对于多个post meta,您可以像这样使用meta\\u查询
$args = array(
\'post_type\' => \'assignment\',
\'post_status\' => \'publish\',
\'meta_query\' => array(
array(
\'key\' => \'color\',
\'value\' => \'blue\',
),
array(
\'key\' => \'year\',
\'value\' => \'2017\',
)
),
);