[wp-trac] [WordPress Trac] #10655: Post/Page ID Count skips one number when a new page or post created in WordPress 2.8.2

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 16 01:33:43 UTC 2010


#10655: Post/Page ID Count skips one number when a new page or post created in
WordPress 2.8.2
--------------------------+-------------------------------------------------
 Reporter:  misty9        |        Owner:         
     Type:  defect (bug)  |       Status:  closed 
 Priority:  low           |    Milestone:         
Component:  General       |      Version:  2.8.2  
 Severity:  minor         |   Resolution:  invalid
 Keywords:                |  
--------------------------+-------------------------------------------------

Comment(by nacin):

 Here are just some of the various things that might be a row in the
 "posts" table:

  - posts and pages, including those in drafts and trash.
  - revisions of posts and pages.
  - autosaves of posts and pages.
  - attachments (uploads) that are attached to posts, pages, or are
 orphaned.

 I've probably missed a few, and I'm ignoring custom post types as well.
 One row in the "posts" table is not equal to one "post", period.

 Finally, the main point of this comment: If you need to display the number
 of posts, then use the API. Specifically, I'd start with
 http://codex.wordpress.org/Function_Reference/wp_count_posts, which has
 existed since 2.5.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10655#comment:16>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list