哇,你用这个答案拯救了我的一天,我试图通过名为type\\u price的自定义数字字段筛选帖子,我正试图这样做:
\'meta_query\' => array(
array(
\'key\' => \'type_price\',
\'value\' => array( 0, 500000 ),
\'compare\' => \'BETWEEN\',
\'type\' => \'NUMERIC\',
)),
但应该这样做ASC:
array(
\'posts_per_page\' => -1,
\'meta_key\' => \'type_price\',
\'orderby\' => \'meta_value_num\',
\'order\' => \'ASC\',
\'meta_query\' => array(
array(
\'key\' => \'type_price\',
\'value\' => array( 0, 500000 ),
\'compare\' => \'BETWEEN\',
\'type\' => \'NUMERIC\',
)
)),
非常感谢:)