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:
parent
b4d02c0898
commit
b8b2f2115b
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue