When editing a hierarchical post type (post or pages for example), there is a “page attributes” metabox with a dropdown for selecting parent. I would like to be able to modify this list.
However, the arguments of wp_dropdown_pages are hard-coded in the wp-admin/includes/meta-boxes.php: page_attributes_meta_box function. A filter named ‘wp_dropdown_pages’ already exists, but it only allows manipulating the generated HTML list (and it has no post ID parameter so re-generating the list from database is not possible).
The ability to change the query itself could be useful. It would allow limiting the hierarchy depth or restricting the list to certain items when having a lot of them.
If this is not possible, please add an optional post ID argument to the wp_pages_dropdown filter.
(The specific reason for this request is the following: I’m writing a gallery plugin and I’d like to represent albums as custom post types. Albums have either subalbums or photos as children (but not both). Therefore, I’d like to include only those albums as possible parents which could have subalbums.)
- The topic ‘Add filter for parent dropdown’ is closed to new replies.