您可以使用meta_query
属性获取post数据时使用new WP_Query()
$vehicles = new WP_Query([
\'post_type\' => \'vehicle\',
\'meta_query\' => [
\'relation\' => \'AND\',
[
\'key\' => \'wheel\',
\'value\' => \'4\',
],
[
\'key\' => \'color\',
\'value\' => \'blue\',
]
]);
WP_Query official docs