你试过这个吗:
$args = array(
\'post_type\' => \'foo\',
\'meta_key\' => \'bar\',
\'meta_value\' => $bar_value,
\'posts_per_page\' => 10,
);
$res = new WP_Query($args);
to
$args = array(
\'post_type\' => \'foo\',
\'meta_key\' => \'bar\',
\'meta_value\' => $bar_value,
\'meta_compare\' => \'=\',
\'posts_per_page\' => 10,
);
$res = new WP_Query($args);
阅读以下内容:
WP_Query