{"id":1263,"date":"2016-01-29T14:31:54","date_gmt":"2016-01-30T00:31:54","guid":{"rendered":"http:\/\/mymonkeydo.com\/?p=1263"},"modified":"2016-01-29T14:31:54","modified_gmt":"2016-01-30T00:31:54","slug":"speed-up-wp_query","status":"publish","type":"post","link":"https:\/\/mymonkeydo.com\/speed-up-wp_query\/","title":{"rendered":"Speed up WP_Query"},"content":{"rendered":"
In WordPress, when a query does not need paging and you only want a limited amount of results, like the last 5 posts, set\u00a0the ‘no_found_rows’ parameter to true. \u00a0This\u00a0prevents WordPress from doing additional work in counting the total matched rows, thus speeding up your query.<\/p>\n
This\u00a0is already built into get_posts, but not WP_Query.<\/p>\n
Example:<\/p>\n
$last_5_query = WP_Query( array( ‘no_found_rows’=> true, ‘posts_per_page’=>5 ) );<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[2],"tags":[51,53,64],"yoast_head":"\n