我想查询和排序的元键“流行”的职位,这些职位还必须有另一个元键“去”与值“1”查询
$args = array(
\'post_status\' => \'publish\',
\'posts_per_page\' => \'150\',
\'cat\' => $cat_id,
\'order\' => \'DESC\'
\'meta_query\' => array(
\'relation\' => \'AND\',
\'popularity\' => array(
\'key\' => \'popularity\',
\'orderby\' => \'meta_value_num\',
),
\'be_price\' => array(
\'key\' => \'gone\',
\'value\' => \'1\'
)
)
);
SO网友:Jeroen Schmit
我不确定是什么\'be_price\'
是的,但我认为$args
应如下所示:
$args = array(
\'post_status\' => \'publish\',
\'posts_per_page\' => \'150\',
\'cat\' => $cat_id,
\'meta_key\' => \'popularity\',
\'order\' => \'DESC\',
\'orderby\' => \'meta_value_num\',
\'meta_query\' => array(
\'key\' => \'gone\',
\'value\' => \'1\'
)
);
SO网友:Oscprofessionals
$args = array(
\'post_status\' => \'publish\',
\'posts_per_page\' => \'150\',
\'cat\' => $cat_id,
\'order\' => \'DESC\',
\'meta_query\' => array(
\'relation\' => \'AND\',
\'popularity\' => array(
\'key\' => \'popularity\',
\'orderby\' => \'meta_value_num\'
),
\'gone\' => array(
\'key\' => \'gone\',
\'value\' => \'1\'
)
));
try this