My custom post type name is movie_reviews. Inside movie reviews there are multiple post but i need only that post whose id is 244. My code for it is

    $my_query = new WP_Query('post_type=movie_reviews&ID=244');
      while ($my_query->have_posts()) : $my_query->the_post(); 

endwhile ?>

2 Answers 2


Have a look at the Post & Page Parameters Section in the WP_Query Documentation

For getting a Post by Post ID, you need to use this:

$my_query = new WP_Query('post_type=movie_reviews&p=244');

If you only need the content of one specific post, you can also do this:

$mypost = get_post(244);
echo apply_filters('the_content',$mypost->post_content);

In this case, you don't need to worry about the loop or the global vars getting overwritten, removing your main loop.

  • @benimub then please acccept this answer by clicking on thhe checkmark next to this answer. Thanks Jul 15, 2014 at 11:40
  • What if you don't know the ID, but rather want to search if a specific content is in the database?
    – Breno
    Oct 27, 2016 at 14:37
  • Trying to use the second example but having no success with it Oct 23, 2017 at 1:47
  • Can you Post some Code? Oct 23, 2017 at 4:33

If you wanna use in loop and use for each post

$mypost = get_post($post->ID);
echo apply_filters('the_content',$mypost->post_content);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.