Title: function get_posts() limited
Last modified: August 19, 2016

---

# function get_posts() limited

 *  [caiopatu](https://wordpress.org/support/users/caiopatu/)
 * (@caiopatu)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/function-get_posts-limited/)
 * i dont understand on my blog [http://blogdopatu.ueuo.com/](http://blogdopatu.ueuo.com/)
   i have made some kind of headlines for each category, if i use the function
    `
   get_posts('category=1')` this headline limits posts to 5, i want more, and if
   i use `query_posts()` it takes all categories, what i can do?

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

 *  [Equal](https://wordpress.org/support/users/equalmark/)
 * (@equalmark)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/function-get_posts-limited/#post-1278303)
 * How about:
 * `<?php query_posts('showposts=10&cat=1'); ?>`
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/function-get_posts-limited/#post-1278305)
 * If you don’t want to ‘disturbe’ the original query:
 *     ```
       <?php
       //get 10 posts for category 1
       $type = 'post';
           $args=array(
             'category__in'=> array(1),
             'post_type' => $type,
             'posts_per_page'=>10,
             'caller_get_posts'=>1
           );
           $my_query = new WP_Query($args);
           if( $my_query->have_posts() ) {
             echo 'All ' . $type . '(s) with metakey '.$metakey;
             while ($my_query->have_posts()) : $my_query->the_post(); ?>
               <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
              <?php
             endwhile;
           } //if ($my_query)
         wp_reset_query();  // Restore global post data stomped by the_post().
       ?>
       ```
   

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

The topic ‘function get_posts() limited’ is closed to new replies.

## Tags

 * [functions](https://wordpress.org/support/topic-tag/functions/)
 * [limit](https://wordpress.org/support/topic-tag/limit/)

 * 2 replies
 * 3 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/function-get_posts-limited/#post-1278305)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
