Title: found_posts
Last modified: August 19, 2016

---

# found_posts

 *  [ckruse](https://wordpress.org/support/users/ckruse/)
 * (@ckruse)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/found_posts/)
 * Can someone please shed some light on the $wp_query->found_posts option. I did
   not find much on it. It seems to hold the result for all possible posts in a 
   given query, even if the query has a limit on it.
 * Example: If I have 10 posts and set showposts=2, it will display 2 but say it
   found 10.

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

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/found_posts/#post-1155974)
 * Found posts is part of the WP_Query Object…
 * As you said it simply holds the value of the total results..
 * All you need to know should be here.
    [http://codex.wordpress.org/Function_Reference/WP_Query](http://codex.wordpress.org/Function_Reference/WP_Query)
 * Is there something in particular you need to know?
 *  Thread Starter [ckruse](https://wordpress.org/support/users/ckruse/)
 * (@ckruse)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/found_posts/#post-1156011)
 * Mostly just curious. I recently wrote my own pagination script which was obviously
   more then it needed to be. I found this property and it solved all my problems.
   On my index page I was limiting the number of posts shown to 5 (showposts=5),
   but I wanted, at the bottom with the pagination to display the total number of
   pages, like PAGE 1 OF 10. So I stored the query request
 * $theQuery = $wp_query->request;
 * Then I stripped the LIMIT from that request, as it was limiting to 5. Then re-
   ran the query without the limit for the sole purpose of getting the total number
   of posts based on my query. A lot of work and database stuff for nothing.
 * I did not realize the wp_query object had that property stored.
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/found_posts/#post-1156196)
 * Plonk this in one of your template files…
 *     ```
       print '<pre>';
       print_r($wp_query);
       print '</pre>';
       ```
   
 * Will give you plenty of info about what’s stored in wp_query…
 * That’s what i did before posting the link, was quicker to do as i already had
   the editor and local install open on my screen…
 *  [marissenruben](https://wordpress.org/support/users/marissenruben/)
 * (@marissenruben)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/found_posts/#post-1156285)
 * *bump*
 * I have a plugin which uses the following piece of code:
 *     ```
       $this->found_posts = (int)$wp_query->found_posts;
       ```
   
 * But i want to exclude a category, how can i adjust that “$wp_query” thingy? It
   isn’t set in the plugin it’s self.
 * The plugin is for “pagination”. And the problem is, the plugin sees more posts
   becuz i used the “posts system” to post “portfolio items” which are not shown
   in the weblog itself.

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

The topic ‘found_posts’ is closed to new replies.

 * 4 replies
 * 3 participants
 * Last reply from: [marissenruben](https://wordpress.org/support/users/marissenruben/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/found_posts/#post-1156285)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
