我在一个函数中有一个查询,它返回我不想要的匹配项,例如,当$id=116时,它还返回meta\\u键“funds\\u id”为11687的结果。
public function list_related_docs($id){
$docs_args = array(
\'post_type\' => \'publication\',
\'post_status\' => \'publish\',
\'posts_per_page\'=> -1,
\'orderby\' => \'meta_value_num title\',
\'order\' => \'ASC\',
\'meta_key\' => \'fund_list_order\',
\'limit\' => 4,
\'suppress_filters\' => 0,
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'key\' => \'funds_id\',
\'value\' => $id,
\'compare\' => \'LIKE\'
),
array(
\'key\' => \'fund_list_order\',
\'compare\' => \'EXISTS\',
)
)
);
$docs_posts = get_posts($docs_args);
// more stuff
}
我尝试使用“compare”=>“=”,但没有返回任何结果。谢谢