WordPress Post Looping? [duplicate]

Interesting question. Wp_Query will return all posts that match the criteria. To enhance performance, you can switch off pagination with no_found_rows=true. You want both pagination and limit the amount of results returned. That’s not something wp_query can deliver.

So the most obvious though not too elegant solution would be to modify your loop in the same way you modify your pagination to cut off the superfluous results:

while( $query->have_posts() ) {
   if (($wp_query->current_post) =< 10 ) {
      $query->the_post();
      the_title();
      }
  }

An alternative way would be to use wpdb and build your own mysql query. Or use no_found_rows and build your own pagination for the results.