WordPress.org

Ready to get started?Download WordPress

Forums

Add filter for parent dropdown (2 posts)

  1. molnarm
    Member
    Posted 3 years ago #

    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.)

  2. e
    Member
    Posted 3 years ago #

    Thumbs up for this, a client has got 500 pages in their WordPress and it is impossible to find anything within a 500 items dropdown.
    A search function or something like wp_list_pages would be very useful, preferably the last one.

Topic Closed

This topic has been closed to new replies.

About this Topic