Allow get_pages to work with non-hierarchical post types
|Reported by:||aaroncampbell||Owned by:|
|Component:||Posts, Post Types||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.
Change History (7)
- Milestone 3.1 deleted
- Resolution set to duplicate
- Status changed from new to closed
comment:3 grandslambert — 3 years ago
- Cc shane@… added
- Resolution duplicate deleted
- Status changed from closed to reopened