• 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'   => 'https://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)
  • 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.