butterbean icon indicating copy to clipboard operation
butterbean copied to clipboard

align parent control args with the default parent dropdown

Open m-e-h opened this issue 9 years ago • 5 comments

The default parent select includes other child posts among the options. 'post_parent' => 0 in butterbean only shows top-level posts.

Not sure what the default is or if NULL could be used for the value. Core uses wp_dropdown_pages which defaults to pages and sub-pages if depth isn't specified? https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/meta-boxes.php#L780-L798

m-e-h avatar Aug 25 '16 22:08 m-e-h

I'm not sure I understand what the issue is. You seem to be talking about the default arguments and the post_parent field?

justintadlock avatar Aug 25 '16 22:08 justintadlock

Are you asking to show a hierarchical drop-down?

If so, this specific control is not meant to be a replacement for the WP parent drop-down. That should really be used when possible. This is meant to be a drop-down of a flat post type. I could see renaming it to parent-flat if necessary.

justintadlock avatar Aug 25 '16 22:08 justintadlock

Thats correct, a hierarchical drop-down. My specific use case is a cpt which relies on the parent child hierarchy, which I could use the page attributes metabox, but I was thinking more for consistency and user expectation.

m-e-h avatar Aug 25 '16 22:08 m-e-h

That would take a rewrite of the control to handle both hierarchical or non-hierarchical post types. Or, just a custom control for handling hierarchical post types. I'd lean toward the latter option for now and maybe revisit adding a hierarchical parent control in future version of ButterBean.

justintadlock avatar Aug 25 '16 22:08 justintadlock

OK, I wasn't thinking it had to be one or the other. I understand now.

m-e-h avatar Aug 25 '16 22:08 m-e-h