Title: limit wp_list_pages
Last modified: August 18, 2016

---

# limit wp_list_pages

 *  Resolved [peli](https://wordpress.org/support/users/peli/)
 * (@peli)
 * [19 years ago](https://wordpress.org/support/topic/limit-wp_list_pages/)
 * How can I limit the list of pages?
    I am using: <?php wp_list_pages(‘title_li
   =&sort_column=post_date&sort_order=DESC’); ?> but I wolud like to list the only
   25 newest pages, not the whole list. I can not use the include or the exclude
   arguments, because then I have to change it every day.
 * Is there any solution?

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

 *  [Bodhipaksa](https://wordpress.org/support/users/haecceity/)
 * (@haecceity)
 * [19 years ago](https://wordpress.org/support/topic/limit-wp_list_pages/#post-558996)
 * [http://www.semiologic.com/2005/04/10/wordpress-recent-plugin-collection/](http://www.semiologic.com/2005/04/10/wordpress-recent-plugin-collection/)
 * “Recent updates displays a list of recently updated pages on your WordPress blog.”
 *  [rudolf45](https://wordpress.org/support/users/rudolf45/)
 * (@rudolf45)
 * [19 years ago](https://wordpress.org/support/topic/limit-wp_list_pages/#post-559001)
 * The bad thing is… pages and Pages are two different things in WP. And the OP 
   was asking about Pages.
    (meanwhile the plugin author should make it clear: it
   is about posts!)
 *  [yoshi](https://wordpress.org/support/users/yoshi/)
 * (@yoshi)
 * [19 years ago](https://wordpress.org/support/topic/limit-wp_list_pages/#post-559005)
 * The best way I think is to write a little function that does the similar job 
   as wp_list_pages. However, here’s an alternative way.
 *     ```
       <?php $pages = wp_list_pages('title_li=&sort_column=post_date&sort_order=DESC&depth=-1&echo=0');
       preg_match_all('/(<li.*?>)(.*?)<\/li>/i', $pages, $matches);
       if (!empty($matches[0])) {
         print '<ul>' . implode("\n", array_slice($matches[0],0,25)) . '</ul>';
       }
       ?>
       ```
   
 * Note that this won’t work if `depth` parameter set to other than -1 when there
   are child pages.
 *  [Bodhipaksa](https://wordpress.org/support/users/haecceity/)
 * (@haecceity)
 * [19 years ago](https://wordpress.org/support/topic/limit-wp_list_pages/#post-559045)
 * “meanwhile the plugin author should make it clear: it is about posts!”
 * Yes indeed! He had me fooled!
 *  Thread Starter [peli](https://wordpress.org/support/users/peli/)
 * (@peli)
 * [19 years ago](https://wordpress.org/support/topic/limit-wp_list_pages/#post-559049)
 * it seems that the function works fine.
 * thanks yoshi

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

The topic ‘limit wp_list_pages’ is closed to new replies.

## Tags

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

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 5 replies
 * 4 participants
 * Last reply from: [peli](https://wordpress.org/support/users/peli/)
 * Last activity: [19 years ago](https://wordpress.org/support/topic/limit-wp_list_pages/#post-559049)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
