我只是用我的投资组合做了这样的事。以下是我用来让我的工作:
$args = array(
\'post_type\' => \'portfolio\',
\'posts_per_page\' => \'-1\',
\'meta_key\' => \'date_received\',
\'orderby\' => \'meta_value_num\',
\'order\' => \'DESC\'
);
remove_all_filters(\'posts_orderby\');
$query = new WP_query($args);
我有一个CPT,并使用名为“date\\u received”的ACF日期选择器。我在获取
orderby
工作,直到我添加
remove_all_filters(\'posts_orderby\');