Title: Problem with getting all posts
Last modified: August 21, 2016

---

# Problem with getting all posts

 *  Resolved [josespinal](https://wordpress.org/support/users/josespinal/)
 * (@josespinal)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/problem-with-getting-all-posts/)
 * Hi,
 * I’m having problems getting ALL posts for my custom post type. I’ve tried using
   both get_posts() and WP_Query() with no luck. Here is the code (tried both posts_per_page
   and numberposts parameters).
 * If I set a number like 200 in posts_per_page, I get 200 posts, when I try _1,000_
   or _-1_ it returns empty. What could this be??
 * Thanks
 *     ```
       $stores_args = array(
         'post_type' => 'stores',
         'posts_per_page' => -1,
         'order' => 'ASC',
         'orderby' => 'title'
       );
   
       $query = get_posts( $stores_args );
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [josespinal](https://wordpress.org/support/users/josespinal/)
 * (@josespinal)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/problem-with-getting-all-posts/#post-4930889)
 * It was a memory limit issue.

Viewing 1 replies (of 1 total)

The topic ‘Problem with getting all posts’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [josespinal](https://wordpress.org/support/users/josespinal/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/problem-with-getting-all-posts/#post-4930889)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
