我有一个php代码,如下所示,我想在其中排序WP_Post Object
按对象字段排列post_date
.
if ( $search ) {
$area_query = new \\WP_Query( [
\'s\' => $search,
\'post_type\' => \'abc-xyz\',
\'post_status\' => \'publish\'
] );
}
这就是我尝试的目的WP_Post object
数组,但它似乎不起作用。if ( $search ) {
$area_query = new \\WP_Query( [
\'s\' => $search,
\'post_type\' => \'abc-xyz\',
\'post_status\' => \'publish\',
\'orderby\' => \'date\',
\'order\' => \'ASC\',
] );
}
Problem Statement:
我想知道我应该在上面的php代码中做些什么更改,以便对其进行排序WP_Post
对象数组按日期排序。