Title: get_posts ignoring posts_per_page
Last modified: August 19, 2016

---

# get_posts ignoring posts_per_page

 *  Resolved [marcusds](https://wordpress.org/support/users/marcus1060/)
 * (@marcus1060)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/get_posts-ignoring-posts_per_page/)
 * In a function in a theme’s functions.php I have
 *     ```
       $postslist = get_posts('posts_per_page=3');
       echo count($postslist);
       ```
   
 * Why does it keep returning more than 3? How do I fix this?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [marcusds](https://wordpress.org/support/users/marcus1060/)
 * (@marcus1060)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/get_posts-ignoring-posts_per_page/#post-1813633)
 * OK, well after a long time searching I believe I’ve found the issue by looking
   in the source code.
    Should be numberposts not posts_per_page. The Docs list 
   it incorrectly.
 * Posting this here if anyone stumbles upon this with the same problem.
 *  [sparkweb](https://wordpress.org/support/users/sparkweb/)
 * (@sparkweb)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/get_posts-ignoring-posts_per_page/#post-1813812)
 * It appears that this was corrected in WP 3.1, though plugin developers shouldn’t
   use it for a while, to preserve backwards compatibility.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘get_posts ignoring posts_per_page’ is closed to new replies.

## Tags

 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)
 * [posts_per_page](https://wordpress.org/support/topic-tag/posts_per_page/)

 * 2 replies
 * 2 participants
 * Last reply from: [sparkweb](https://wordpress.org/support/users/sparkweb/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/get_posts-ignoring-posts_per_page/#post-1813812)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
