实际主题插件开发中,我们可能需要用到自定义字段custom fields的搜索,并且用来排序,而且是多个。我们这里记录一下代码
$args = array(
'post_type' => DEBBING_TYPE_SLUG,
'meta_query' => array(
array(
'relation' => 'AND',
'status_clause' => array(
'key' => '_debbing_status',
'type' => 'NUMERIC',
),
'order_clause' => array(
'key' => '_debbing_order',
'type' => 'NUMERIC',
),
)
),
'orderby' => array(
'status_clause' => 'DESC',
'order_clause' => 'DESC',
)
);
query_posts($args);