Fix wp_tag_cloud 'RAND' when only one tag, props DD32, fixes #9214
git-svn-id: https://develop.svn.wordpress.org/trunk@10636 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
05d5a09814
commit
90787e8823
|
@ -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