[wp-trac] [WordPress Trac] #6772: get_posts Should Use WP_Query

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 18 19:16:40 GMT 2008


#6772: get_posts Should Use WP_Query
----------------------+-----------------------------------------------------
 Reporter:  filosofo  |       Owner:  anonymous                        
     Type:  defect    |      Status:  new                              
 Priority:  normal    |   Milestone:  2.6                              
Component:  General   |     Version:  2.6                              
 Severity:  normal    |    Keywords:  wp_query get_posts wpdb has-patch
----------------------+-----------------------------------------------------
 get_posts currently runs its own db queries based on the parameters it
 receives.  Instead, it should query posts using WP_Query.  Advantages:
  * It avoids redundancy.  query_posts and get_posts will have similar
 behavior, and a change in one place won't have to be doubled in the other.
  * It adds functionality to both means of querying posts: all parameters
 passed to get_posts can be passed to query_posts, and vice-versa.
  * It fixes some of get_posts problems, such as those for meta_key and
 meta_value, which currently are broken.
  * It allows get_posts queries and results to be filtered.

 To address the concern that this might be making significant changes to
 behavior, I've made a page template that lets you try queries in both the
 old get_posts and my proposed get_posts, simultaneously, with the results
 shown side-by-side.  Just assign the attached template to a page, apply
 the patch, and you can see how my proposed get_posts query will work.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6772>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list