我有一个帖子列表,其中有一列我想按字母顺序排列。问题是,这些帖子在同一列中显示了两种不同的自定义字段值类型之一。其中一个(customer\\u name)是post对象,另一个(quick\\u customer\\u name)只是常规自定义字段。
我在下面尝试的代码让我成功了一半,它确实查询了顶部有一个值的帖子,但仍然没有按字母顺序排列。
$posts_per_page = 10;
$paged = ( get_query_var(\'paged\') ) ? get_query_var(\'paged\') : 1;
$args = array(
\'post_type\' => \'offerter\',
\'post_status\' => \'publish\',
\'posts_per_page\' => $posts_per_page,
\'paged\' => $paged,
\'meta_key\' => \'business_id\',
\'meta_value\' => $business_id,
\'meta_query\' => array(
\'relation\' => \'OR\',
\'customer_name\' => array(
\'key\' => \'customer_name\',
\'compare\' => \'LIKE\',
),
\'quick_customer_name\' => array(
\'key\' => \'quick_customer_name\',
\'compare\' => \'LIKE\',
),
),
\'orderby\' => array(
\'customer_name\' => \'desc\',
\'quick_customer_name\' => \'desc\',
)