WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 have a custom template file I've been workin on. I have this code performing a loop after it queries posts from a certain category. This works and I have each post configured with styled divs, but for some reason, on the side of the page, I have strange numbers being displayed. I don't understand where they are coming from. The most posts in a category, the more numbers.

Example #'s on page: 65138 I believe the 138 is the post ID of one of the posts being called in my while loop. I'm not sure what the 65 means. Am I using a function that is echoing these values for some reason and I don't know it??

 // Select the category to get posts from.
$posts_of_interest = query_posts('cat=5');
$num_of_posts = count($posts_of_interest);
if(have_posts()) :
while( $i <= $num_of_posts):
    $queried_post = get_post(the_ID());
    echo $queried_post->post_content;   


share|improve this question
Unless you absolutely need to modify the main query, you should be using get_posts() instead of query_posts(). – Joseph Leedy Aug 2 '12 at 2:59
up vote 3 down vote accepted

change the_ID() to get_the_ID(). calling the_ID() prints the post's ID, while get_the_ID() simply returns it and allows you to use it further on.

reference : get_the_ID()

share|improve this answer
awesome, thanks! :D – Morphiuz Aug 1 '12 at 20:32
no problem! glad i could help :D – peteroak Aug 1 '12 at 20:33

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.