Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Each post has an ID and I would like to know how they were assigned. Is there a pattern? Why are the ID's not being incremented by 1 every posts? It would be easier..My ID's go from 9867, to 9869, to 9864, etc.. I can't seem to find a pattern.

I could use "The Loop", but I'm doing that from another site. I want to include the last 30 posts of my wordpress site, so I need to find a pattern in the url to get the last 30 posts.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Each auto-draft gets its own ID, each revision, each nav item, page, custom post type …

The actual ID of a post should be irrelevant, this is really just needed for the database and ugly permalinks.

You cannot get the last 30 items by inspecting the post ID only.

Install a REST API on the other site and a rule to get the last x items.

share|improve this answer
Then how can I retrieve the last 30 items from an external domain? –  Maxwell Apr 10 '13 at 15:22
@Maxwell See my update. –  toscho Apr 10 '13 at 15:24
Thank you. It looks like a very complicated solution though. –  Maxwell Apr 10 '13 at 15:25
If you take my code it is done in less than 20 minutes. Really not that complicated. :) –  toscho Apr 10 '13 at 15:26
20 mins for you, @toscho :) –  vancoder Apr 10 '13 at 16:56

Use the RSS feed - typically at http:/sitename/feed.

You can set the number of items the fed contains by changing the value Syndication feeds show the most recent in Settings > Reading

share|improve this answer
This is a very vague 'answer'. –  vancoder Apr 10 '13 at 16:55
@vancoder Feel free to improve it or leave your own answer :) –  anu Apr 10 '13 at 16:57
I only leave answers when I have one to leave :) –  vancoder Apr 10 '13 at 17:21

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.