jawittdesigns
5/31/2014 - 10:16 PM

WordPress Custom Query

WordPress Custom Query

$query = new WP_Query( array(
  'post_type'              => 'post',
  'no_found_rows'          => true,
  'no_found_rows'          => true,  // useful when pagination is not needed.
  'update_post_meta_cache' => false, // useful when post meta will not be utilized.
  'update_post_term_cache' => false, //useful when taxonomy terms will not be utilized.
  'fields'                 => 'ids', //useful when only the post IDs are needed (less typical).
) );
if( have_posts() ) : 
  while( $query->have_posts() ) : 
    $query->the_post();
    
  endwhile; 
endif; 
wp_reset_postdata();