[wp-trac] [WordPress Trac] #19776: wp_dropdown_categories (using with taxonomy) defaults if no terms
WordPress Trac
wp-trac at lists.automattic.com
Sun Jan 8 04:02:15 UTC 2012
#19776: wp_dropdown_categories (using with taxonomy) defaults if no terms
----------------------------+-----------------------------
Reporter: helgatheviking | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
----------------------------+-----------------------------
the default args for wp_dropdown_categories produce an empty select box
when using wp_dropdown_categories for a taxonomy for which there are no
terms. I produced this both w/ the filters on the edit.php screen
(restrict_manage_posts) and on the front end in my theme. I presume this
case never occurs with post categories as there is always Uncategorized.
{{{
$args = array(
'show_option_none' => ,
'taxonomy' => 'featured',
'hide_if_empty' => false );
}}}
lines 340-343 in wp-includes/category-template.php are
{{{
if ( ! $r['hide_if_empty'] || ! empty($categories) )
$output = "<select name='$name' id='$id' class='$class'
$tab_index_attribute>\n";
else
$output = '';
}}}
so in a taxonomy that has no terms, the $categories variable is indeed
empty, but the default arg is false, so the ! $r['hide_if_empty']
condition is satisfied and you get the opening of the select input, but
you don't get any options therein (since they don't exist. and by
default, you don't get any notice of such.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19776>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list