Title: wp_query using post_id
Last modified: August 22, 2016

---

# wp_query using post_id

 *  [aniketsawal123](https://wordpress.org/support/users/aniketsawal123/)
 * (@aniketsawal123)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/wp_query-using-post_id/)
 * I want to retrieve the post using the post id.
    But i found that its retrieving
   the post based on custom post type and not by post id. This my code. Please give
   me some suggestions.
 *     ```
       $args = array(
       	    'post_type' => 'landingpage',
                   'post_id' => '4110',
       	    'post_status' => 'publish',
       	    'meta_query' => array(
       	       						 'relation' => 'AND',
       							        array(
       							            'key'     => 'page_link',
       							            'value'   => 'http://5.heypayless/Landing%20Pages/dedicated-web-programmers/',
       							            'compare' => '='
       							      )
       						    )    
   
       	);
   
       	   $obituary_query = new WP_Query($args);
       	while ($obituary_query->have_posts()) : $obituary_query->the_post();
       		$test= get_field('price/hr_for_test_services');
       		$junior=get_field('price/hr_for_junior');
       		$senior=get_field('price/hr_for_senior');
       		$lead=get_field('price/hr_for_lead_designer');
       		$features=get_field('features_for_test_services');
       		$features2=get_field('features_for_junior');
       		$features3=get_field('features_for_senior');
       		$features4=get_field('features_for_lead_designer');
       	endwhile;
       	 echo $post->ID;
       	wp_reset_postdata();
   
       	?>
       ```
   

Viewing 1 replies (of 1 total)

 *  [edegaru](https://wordpress.org/support/users/edegaru/)
 * (@edegaru)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/wp_query-using-post_id/#post-5948573)
 * Why are you building a query with so many parameters, if you already have the
   ID of the post? The ID is unique.

Viewing 1 replies (of 1 total)

The topic ‘wp_query using post_id’ is closed to new replies.

## Tags

 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [edegaru](https://wordpress.org/support/users/edegaru/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/wp_query-using-post_id/#post-5948573)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
