admin管理员组

文章数量:1294327

I want to display 12 articles first goes the latest BUT i want to show only one post per user. For example if user A wrote 2 artticles today i want to display only the latest of his articles.

Here is the query i use

<?php
                
        //the array 1
                $args = array(
                /*'posts_per_page' => 12, /* how many post you need to display */
                'offset' => 0,
                'orderby' => 'post_date',
                'order' => 'DESC',
                'post_type' => 'blog', /* your post type name */
                'post_status' => 'publish',
                
            );

            $query1 = new WP_Query($args);           
        ?>

So my code now after the comments is like this

<?php
  $args = array(
'posts_per_page' => 12, /* how many post you need to display */
'offset' => 0,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'blog', /* your post type name */
'group_by'  => 'date',
'post_status' => 'publish',    
  );
add_filter( 'posts_groupby', 'one_per_author' );
 $query1 = new WP_Query($args);           
        ?>

but i still dont get the latest and some authors are 2 times

本文标签: phpWP query posts BUT show the most recent and one per author