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

I am using wordpress as a quick fix for a blog for my site. I am using a short loop in an external page (i got the links to use the wordpress set-up correctly):

query_posts('p='.$thisPost); //$thisPost enumerates 1,2..etc up to a maximum number of posts

while (have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>

The issue that in the database the wordpress would store post #2 as "p=6", which essentially screws up this setup.

How would I get a post number 2 ( or 3 or n ) from the start?

share|improve this question

The database is not just storing the posts that you have created, it stores revisions of that post along with other post types, etc. all in this table. So the post ids of the posts that we enter rarely go up one at a time.

The post ids themselves are not very relevant in the queries. The specific queries are used to only show posts that have a certain criteria, such as category, post_type, date stored, etc.

share|improve this answer

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.