fetch all post from wp multisite network and sort all the post in descending order on the basis of "Created by " term
$all_blog = get_last_updated();
$countpost = 1;
foreach ($all_blog as $key=>$current_blog) {
if($current_blog['blog_id'] != 1){
switch_to_blog($current_blog['blog_id']);
global $post;
$custom_query_args = array(
'post_type' => 'post',
'meta_key' => 'xyz',
'meta_value' => 'yes',
);
here I am getting sorted array of different sub domain.. but still I want to sort this
fetch all post from wp multisite network and sort all the post in descending order on the basis of "Created by " term
$all_blog = get_last_updated();
$countpost = 1;
foreach ($all_blog as $key=>$current_blog) {
if($current_blog['blog_id'] != 1){
switch_to_blog($current_blog['blog_id']);
global $post;
$custom_query_args = array(
'post_type' => 'post',
'meta_key' => 'xyz',
'meta_value' => 'yes',
);
here I am getting sorted array of different sub domain.. but still I want to sort this
Share Improve this question edited Sep 20, 2019 at 5:17 Jacob Peattie 44.2k10 gold badges50 silver badges64 bronze badges asked Sep 20, 2019 at 3:40 Prem Kr GuptaPrem Kr Gupta 12 bronze badges1 Answer
Reset to default 0So you first want to order them by author and then by date for every author?
You should use the orderby
argument in your query, where you can pass an array.
$custom_query_args = array(
'post_type' => 'post',
'meta_key' => 'xyz',
'meta_value' => 'yes',
'orderby' => array( 'author' => 'ASC', 'date' => 'DESC' )
);
This should be something like what you want, otherwise look at the examples for the arguments in WP_Query.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745143783a4613552.html
评论列表(0条)