[wp-trac] [WordPress Trac] #14823: Allow get_pages to work with non-hierarchical post types

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 9 23:24:17 UTC 2010

#14823: Allow get_pages to work with non-hierarchical post types
 Reporter:  aaroncampbell  |       Owner:                        
     Type:  defect (bug)   |      Status:  new                   
 Priority:  normal         |   Milestone:  3.1                   
Component:  Post Types     |     Version:                        
 Severity:  normal         |    Keywords:  dev-feedback has-patch
 I discovered this issue while working on making a custom post type a child
 of another custom post type.  I know that's an edge case, but stay with
 me.  I needed something like `page_attributes_meta_box()` but I needed to
 show the parent post type in the dropdown, so I rolled my own (there are
 no filters available for this).

 My new function needed to use `wp_dropdown_pages()` but kept getting an
 empty set.  It turns out it's because `wp_dropdown_pages()` uses
 `get_pages()`, which does a seemingly unnecessary check to make sure the
 post type is hierarchical.  I made it work by making my post type
 hierarchical, but that messes up the URLs.

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

More information about the wp-trac mailing list