optimize wordpress query

107

$post_query = new WP_Query(
	array(
		'post_type'              => 'post',
		'post_status'            => 'publish',
        'posts_per_page'         => '1', // SAME AS LIMIT 1 on SQL
		'orderby'                => 'title',
		'order'                  => 'ASC',		
		'no_found_rows'          => true,
		'update_post_term_cache' => false,
		'update_post_meta_cache' => false,
		'cache_results'          => false
	)
);

/*
no_found_rows (boolean) – make it true when you don’t need any pagination
and don’t need the count for total number of posts found.
cache_results (boolean) – Post information cache.
update_post_meta_cache (boolean) – Post meta information cache.
update_post_term_cache (boolean) – Post term information cache.
*/

Comments

Submit
0 Comments