New Post

The most appropriate use for get_posts is to create an array of posts based on a set of parameters. It retrieves a list of latest posts or posts matching this criteria. get_postscan also be used to create Multiple Loops, though a more direct reference to WP_Queryusing new WP_Query is preferred in this case.

The parameters of get_posts are similar to those of get_pages but is implemented quite differently, and should be used in appropriate scenarios. get_posts usesWP_Query, whereas get_pages queries the database more directly. Each have parameters that reflect this difference in implementation.

query_posts also uses WP_Query, but is not recommended because it directly alters the main loop by changing the variables of the global variable $wp_queryget_posts, on the other hand, simply references a new WP_Query object, and therefore does not affect or alter the main loop.

If you would like to alter the main query before it is executed, you can hook into it usingpre_get_posts. If you would just like to call an array of posts based on a small and simple set of parameters within a page, then get_posts is your best option.