Skip to content

Instantly share code, notes, and snippets.

@kohnmd
Created April 23, 2014 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kohnmd/11225620 to your computer and use it in GitHub Desktop.
Save kohnmd/11225620 to your computer and use it in GitHub Desktop.
WordPress WP_Query on a diet (performs only 2 queries)
<?php
// Found here: http://alexking.org/speaking/core-competency/index.php#/queries-04-wp-query-modifiers
$example = new WP_Query(array(
'posts_per_page' => 2,
'orderby' => 'date',
'order' => 'DESC',
'no_found_rows' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment