基本上,我想执行一个以逗号分隔的搜索,这将导致逗号为AND。当前,搜索结果基于OR关系。我希望结果中包含所有要搜索的关键字。我试过用AND替换OR关系,但是它永远无法正常工作。
$mypost = '';
if ($cs_candidatename != '') {
$qrystr .= '&cs_candidatename=' . $cs_candidatename; // using this in paging
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->users " . $candidatename_id_condition);
if ($post_ids) {
$mypost = array('role' => 'cs_candidate', 'order' => 'DESC', 'orderby' => 'registered', 'user_status' => 1,
'include' => $post_ids,
'fields' => 'ID',
'meta_query' => array(
array(
'key' => 'cs_user_status',
'value' => 'active',
'compare' => '=',
),
array(
'relation' => 'OR',
$resume_search_arr,
$resume_search_arr1,
$resume_search_arr2,
$resume_search_arr3,
$resume_search_arr4,
$resume_search_arr5,
$resume_search_arr6,
$resume_search_arr7,
),
$user_allow_in_search_query,
$location_condition_arr,
)
);
}
} else {
$mypost = array('role' => 'cs_candidate', 'order' => 'DESC', 'orderby' => 'registered', 'user_status' => 1,
'include' => $meta_post_ids_arr,
'fields' => 'ID',
'meta_query' => array(
$user_allow_in_search_query,
$location_condition_arr,
array(
'relation' => 'OR',
$resume_search_arr,
$resume_search_arr1,
$resume_search_arr2,
$resume_search_arr3,
$resume_search_arr4,
$resume_search_arr5,
$resume_search_arr6,
$resume_search_arr7,
),
array(
'key' => 'cs_user_status',
'value' => 'active',
'compare' => '=',
),
)
);
}