[wp-trac] [WordPress Trac] #12821: Merge get_posts() and get_pages()

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 7 04:13:03 UTC 2011


#12821: Merge get_posts() and get_pages()
-------------------------------------+-----------------------------
 Reporter:  mikeschinkel             |       Owner:  garyc40
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  Future Release
Component:  Post Types               |     Version:  3.0
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+-----------------------------

Comment (by garyc40):

 Replying to [comment:30 scribu]:
 > What I mean is that get_posts() should remain unchanged.
 >
 > Any get_pages() specific args, like 'include' should be converted to the
 standard ones ({{{'post__in'}}}) inside get_pages(), before calling
 get_posts() or WP_Query.

 'include' is not a get_pages() specific argument. The inline documentation
 of `get_posts()` specifies that 'include' is an argument, as does
 [http://codex.wordpress.org/Template_Tags/get_posts our codex].

 In my patch, `get_pages()`  call `get_posts()`, so converting args like
 `include` inside `get_pages()` before passing into `get_posts()` would
 result into duplicate code.

 Also, I think `get_pages()` should become a wrapper of `get_posts()`, in
 the sense that `get_posts()` should process arguments that are associated
 with hierarchical post types. In other words, whatever arguments that
 `get_pages()` can handle, `get_posts()` itself must also be able to
 handle.

 There are indeed some non-standard arguments in `get_pages()` such as
 `post_parent`, `sort_order`, `number` etc. but as you can see in the
 patch, they all get mapped into standard arguments (`parent`, `order`,
 `numberposts` etc.) for get_posts().

 Other arguments like `child_of`, `depth` should be supported by
 `get_posts()` in case the developer wants to use it with a hierarchical
 post type.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12821#comment:31>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list