Fix wp_tag_cloud 'RAND' when only one tag, props DD32, fixes #9214

git-svn-id: http://svn.automattic.com/wordpress/trunk@10636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-02-23 09:12:59 +00:00
parent b4d02c0898
commit b8b2f2115b
1 changed files with 4 additions and 1 deletions

View File

@ -659,10 +659,13 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
if ( 'DESC' == $order ) if ( 'DESC' == $order )
$tags = array_reverse( $tags, true ); $tags = array_reverse( $tags, true );
elseif ( 'RAND' == $order ) { elseif ( 'RAND' == $order ) {
$keys = array_rand( $tags, count( $tags ) ); $keys = (array) array_rand( $tags, count( $tags ) );
$temp = array();
foreach ( $keys as $key ) foreach ( $keys as $key )
$temp[$key] = $tags[$key]; $temp[$key] = $tags[$key];
$tags = $temp; $tags = $temp;
$temp = null;
unset( $temp ); unset( $temp );
} }