Title: Show Total Posts
Last modified: August 19, 2016

---

# Show Total Posts

 *  [JSauce16](https://wordpress.org/support/users/jsauce16/)
 * (@jsauce16)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/show-total-posts/)
 * Hello,
 * I want to show the total number of posts in my database.
 * I found this:
 *     ```
       <?php
       $count_posts = wp_count_posts();
       ?>
       ```
   
 * But it doesn’t seem to show anything. How can I, simply, without a plugin, show
   the number of posts in the database?
 * Thanks,
 * Jon

Viewing 1 replies (of 1 total)

 *  [richarduk](https://wordpress.org/support/users/richarduk/)
 * (@richarduk)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/show-total-posts/#post-2043566)
 *     ```
       <?php
       $count_posts = wp_count_posts();
       $published_posts = $count_posts->publish;
       echo '<h1>There are '   .  $published_posts  .  ' published posts</h1>' ;
       ?>
       ```
   
 * That shows published posts. Not sure how you show total number of posts e.g. 
   drafts as well unless do that separately and then add them up
 * [http://codex.wordpress.org/Function_Reference/wp_count_posts](http://codex.wordpress.org/Function_Reference/wp_count_posts)

Viewing 1 replies (of 1 total)

The topic ‘Show Total Posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [richarduk](https://wordpress.org/support/users/richarduk/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/show-total-posts/#post-2043566)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
