wp_list_cats and list_cats are broken in 2.1
|Reported by:||Dickie||Owned by:||Dickie|
|Severity:||major||Keywords:||list_cats wp_list_cats template has-patch commit|
While testing out my theme with WP 2.1 I noticed that the newly depreciated function list_cats does now not work as it used to.
It was defaulting to 'break' behaviour rather than 'list'
This is also true of wp_list_cats although in a different way.
then the display will be an UL list as expected (due to default behaviour), whereas
will show them with BRs ('break' behaviour), but
will show an UL (this is the wrong way round)
as far as the list_cats function is concerned, that template function will display a 'break' list regardless of the settings supplied, either defaulted or not...
I have traced this down to the wp_list_cats function in depreciated.php line 432
if ( !empty($r[ 'list' ]) )
$r[ 'style' ] = 'break';
this needs to be
if ( isset($r[ 'list' ]) )
$r[ 'style' ] = $r[ 'list' ] ? 'list' : 'break';
This is because the function list_cats() will call this, and $r[ 'list' ] will never be empty because it is either defaulted or set by the caller, and therefore it will be set to break.
Plus the test needs to be changed because if the parameter is set to 0 then it is empty, but still set.
I have tested this fix, and it all seems to work fine in all scenarios. (patch file attached, rev 4709)