The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Numbering WordPress Posts

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #154737

    Does anyone know how to number WordPress posts?

    I don’t mean using an ordered list or adding counter to the loop. I mean the first published post is numbered 1, and the 134th post is numbered 134, so no matter how it’s displayed it’ll always have that number associated with it.

    I could just add a custom meta box and number it with that, but I’m looking for a way to do it dynamically.



    Does it really have to start at 1 and can’t skip anything? (what if you have 10 posts numbered 1-10 and number 7 is deleted…does the numbering of posts 8-9-10 adjust to that or will number 7 just not exist anymore? etc.)

    If you don’t care about that, then obviously you could just use the post ID as the unique number.


    A deleted post isn’t an issue. I can deal with gaps like that, but the problem with using post_ID() is other post types and plugins that use post types will add to the number. I want to keep the count for lets say just articles, excluding other post types from that count. It could be like one post is number 20 and the next is 122 if there were posts from other post types made.

    I’m thinking I could make a readonly meta box that queries the posts, count the number of post with a loop, and then add 1 to the meta field, but I’m worried that there might be performance issues if the posts get into the hundreds.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.