justintadlock / butterbean

A neat little post meta framework.
GNU General Public License v2.0
204 stars 31 forks source link

align parent control args with the default parent dropdown #20

Open m-e-h opened 7 years ago

m-e-h commented 7 years ago

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

justintadlock commented 7 years ago

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 commented 7 years ago

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.

m-e-h commented 7 years ago

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.

justintadlock commented 7 years ago

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.

m-e-h commented 7 years ago

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