• Resolved josespinal

    (@josespinal)


    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)
Viewing 1 replies (of 1 total)
  • The topic ‘Problem with getting all posts’ is closed to new replies.