dongli5785 2013-09-16 13:39
浏览 54

如何按meta_key和meta_value对用户列表进行排序

I am very newbie in wordpress and stuck into a task for many hours and not getting any way to sort out this, Thats why I am here....

I want to display a sort list of user based on meta key and meta value but I dont Know what wrong with me I searched google and did as retrieve...

I am trying as:

<?php
$args  = array(  
  'fields' => 'all_with_meta',  
  'meta_query' => array(  
    array(  
    'key' => 'status', // the meta field (or key) we want to target  
    'value' => '1'  // the value we want to target (optional)  

    )  
));  

$users = get_users($args);  
foreach ($users as $client) {
        echo '<li>' . $client->user_email . '</li>';
    }
?>

and in wp meta user table: meta_key=>'status' and meta_value=>'1' for three rows but it showing constant result for any value of meta_value.

Please let me know why I am not getting my desire output... thank you

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 uniapp连接阿里云无法发布消息和订阅
    • ¥25 麦当劳点餐系统代码纠错
    • ¥15 轮班监督委员会问题。
    • ¥15 基于作物生长模型下,有限水资源的最大化粮食产量的资源优化模型建立
    • ¥20 关于变压器的具体案例分析
    • ¥15 生成的QRCode圖片加上下載按鈕
    • ¥15 板材切割优化算法,数学建模,python,lingo
    • ¥15 科来模拟ARP欺骗困惑求解
    • ¥100 iOS开发关于快捷指令截屏后如何将截屏(或从截屏中提取出的文本)回传给本应用并打开指定页面
    • ¥15 unity连接Sqlserver