无法按字母顺序排列目的地

Cannot order destinations alphabetically

我有未排序的目的地,我按以下方式打印:

$destinations = get_posts( array(
                            'post_type' => 'destination_showcase',
                            'posts_per_page' => -1,
                            'post_status' => 'publish',
                            'meta_query' => array(
                                array(
                                    'key' => 'destination_state',
                                    'value' => ':"'.$state_id . '";' , // looking for serialized value in quotes
                                    'compare' => 'LIKE'
                                )
                            ),
                        ) );

我想按字母顺序打印目的地。当我 var_dump-ed #destinations 数组时,我得到了所有目的地及其参数。我想获得他们的头衔,即 "post_title" 并按字母顺序打印。我已经试过了,但没有用:

'orderby'=> $destinations->post_title, 'order' => 'ASC',

知道如何完成任务吗?

如果我正确阅读 WP Query manual,这应该有效:

  get_posts( array(
                        'post_type' => 'destination_showcase',
                        'posts_per_page' => -1,
                        'post_status' => 'publish',
                        'meta_query' => array(
                            array(
                                'key' => 'destination_state',
                                'value' => ':"'.$state_id . '";' , 
                                'compare' => 'LIKE'
                            )

                        ),
                      'orderby' => 'title',
                      'order'   => 'ASC',
                    ) );

试试这个

$destinations = get_posts( array(
    'post_type' => 'destination_showcase',
    'posts_per_page' => -1,
    'post_status' => 'publish',
    'orderby' => 'title',
    'order' => 'ASC',
    'meta_query' => array(
        array(
            'key' => 'destination_state',
            'value' => ':"'.$state_id . '";' , // looking for serialized value in quotes
            'compare' => 'LIKE'
        )
    ),
) );