Skip to main content
edited title
Link

query get_posts always returning the same number of posts = 5

Source Link

query always returning the same number of posts

I don't understand why the code below is always displaying the same number of returned post = 5. When I change the $variable value to another post id of a post with an author with another author_id, I always get 5 returned posts, even if the authors have tens of posts. What am I doing wrong?

$variable=328;
$post = get_post($variable);
    
$author = get_userdata($post->post_author);
    
$args = array(
'author' => $author->id ); 
    
global $post;
     
$myposts = get_posts( $args );
$count= count($myposts);
     
echo '<pre dir="ltr">';
print_r($myposts);
echo '</pre>';
  
echo $count;
 

Your help is really apprecieted.