WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

While phpmyadmin's wp_posts table reports something like this

Showing rows 0 - 29 (10,223 total, Query took 0.0022 sec)
SQL query:
SELECT * FROM  `wp_posts` LIMIT 0 , 30

Wordpress's dashboard reports

All (10,222) | Published (10,222)
Search Posts:  10,222 items « ‹  of 512 › » 

As you can see, there is a disconnect here... 10,222 != 10,223

Does anyone know why WordPress reports 1 less then the actual all post count?

share|improve this question
You seem to have found an answer in wp-hackers list... Would you mind sharing the answer here? – brasofilo Jun 22 '12 at 19:12
will do. if you be patient, you do not have to worry about these things... if you look at some of my old answers, i answer the questions that i myself asked for the other's benefit. these things are a matter of time.. stay cool, we'll do it. – Average Joe Jun 22 '12 at 23:34
Downvote removed. I raised the flag as it would keep anyone from researching for something that already had tons of feedback at wp-lists... Thanks for reporting back! – brasofilo Jun 23 '12 at 20:47

It all comes down to this.

Behind the scenes, WordPress does generate a place-holder post for your next one! And for that special post, it sets the post_status to a special one, 'auto-draft'. Basically, the culprit is the post generated by WordPress without your knowledge.

Once you know this fact, it is easy to understand why there is a disconnect. Wordpress admin screen's ALL count info is based on ALL posts except this special one. WordPress's SQL's WHERE excludes the post whose post_status='auto-draft'.

Whereas, phpMyAdmin's SQL's WHERE needless to say, totally lacks this condition, and hence we end up with the -1 disconnect between the two ALL post counts, causing guys like me the WTH situation.

So under the hood, the cause of the disconnect is this...

select count(*) from `wp_posts`


select count(*) from `wp_posts` where `post_status` <> 'auto-draft'
share|improve this answer
+1 for posting your own answer. – Brian Fegter Sep 25 '12 at 9:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.