我似乎无法弄清楚为什么所有用户都会通过此查询返回。任何帮助将不胜感激。
function user_main(){
$args = array(
'meta_key' => 'profilepicture',
'meta_value' => '3',
'meta_compare' => '='
);
$query = new WP_Query( $args );
$blogusers = get_users( $query );
// Array of WP_User objects.
foreach ( $blogusers as $user ) {
$current_meta = get_user_meta($user->ID, 'profilepicture', true);
write_log($user->ID . ' ' . $current_meta);
}
}
答案 0 :(得分:3)
因为您尝试根据元键=>元值比较来获取用户。所以你需要使用$("#S1value").on("change",function(){
var value = $(this).val();
switch(value) {
case "Title":
$("#input-select").attr("type","text");
break;
case "Application_Date":
$("#input-select").attr("type","date");
break;
default:
$("#input-select").attr("type","text");
}
});
,如下所示: -
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<select id="S1value" name="S1value" >
<option value="Claim" >Claim - C</option>
<option value="Title" >Title - T</option>
<option value="Description" >Description - D</option>
<option value="Abstract" >Abstract - A</option>
<option value="Application_No" >Application_Number - APN</option>
<option value="Priority_Number" >Priority_Number - PN</option>
<option value="Record_Number" >Record_Number - RN</option>
<option value="Priority_Date" >Priority_Date - PD</option>
<option value="Application_Date" >Application_Date - APD</option>
<option value="Publication_Date" >Publication_Date - PD</option>
<option value="US_Class" >US_Class - USC</option>
<option value="IPC_Class" >IPC_Class - IPC</option>
<option value="CPC_Class" >CPC_Class - CPC</option>
<option value="Priority_Country_Code" >Priority Country Code - PCC</option>
<option value="Designate_States" >Designate_States - DS</option>
<option value="Legal_Status_Current" >Legal_Status_Current - LSC</option>
</select>
<input class="input form-control" id="input-select" type="text" />
答案 1 :(得分:1)
您必须使用包含一个或多个数组的meta_query
。
您也可以尝试以下方式。
$meta_query = new WP_Meta_Query();
$meta_query->parse_query_vars( array(
'meta_key' => 'profilepicture',
'meta_value' => '3',
'meta_compare' => '='
) );