我想从具有多个自定义帖子的wp_posts获取记录,并按wp_postmeta.meta_value.
现在,我正在使用此查询:
$args = array(
'numberposts' => -1,
'post_type' => $field_keyn,
'cat' => $fcat_list,
'post_status' => 'publish',
'relation' => 'OR',
);
// The Query
// print_r($args );
$my_query = new WP_Query($args);
if ($my_query->have_posts()) {
while ($my_query->have_posts()) :
$my_query->the_post();
?>
答案 0 :(得分:0)
我认为你的论点数组应该是
$args = array ( 'numberposts' => -1,
'post_type' => $field_keyn,
'cat' => $fcat_list,
'post_status' => 'publish',
'orderby' => 'meta_value_num',
'meta_key' => 'metakeyname' );