您可以首先获取用户,然后对每个用户运行WP\\u查询:。(这是一种快速、简单但未经优化的方法)
$users = get_users( );
foreach ( $users as $user ) {
$args = array(
\'post_type\' => array( \'post\' ),
\'author\' => $user->ID
\'posts_per_page\' => \'1\',
\'order\' => \'DESC\',
\'orderby\' => \'date\',
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
// do something
}
}
wp_reset_postdata();
}