[wp-trac] [WordPress Trac] #33026: Add option filter for wp_dropdown_categories()
WordPress Trac
noreply at wordpress.org
Fri Jul 17 14:57:46 UTC 2015
#33026: Add option filter for wp_dropdown_categories()
-----------------------------+-----------------------------
Reporter: theMikeD | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.2.2
Severity: normal | Keywords:
Focuses: administration |
-----------------------------+-----------------------------
I have a case in which I have a two-level hierarchical taxonomy. The only
way to enforce this two-level hierarchy is to filter the parent list to
top/parent terms only.
For example, given this
{{{
parent term 1
child term 11
child term 12
parent term 2
child term 21
}}}
the only terms that should show up in the 'Parent' list would be `parent
term 1` and `parent term 2`
On the term edit screen, this is handled by using the
`taxonomy_parent_dropdown_args` and `quick_edit_dropdown_pages_args`
filters to add the `depth` parameter, which works great for this purpose.
But I can't do this for the list presented when a new term is added in the
post-edit screen because a similar filter does not exist in
`wp_dropdown_categories()` (the function that creates the list in the post
edit screen). This in turn means that I have to create a new metabox from
scratch, with a custom walker and an almost verbatim copy of
`post_categories_meta_box()` function just to add this parameter into the
args sent to `wp_dropdown_categories()` which is an ugly hacky workaround.
So lets be consistent and add the new filter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33026>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list