Title: Bug in tag clouds?
Last modified: August 18, 2016

---

# Bug in tag clouds?

 *  [adamrice](https://wordpress.org/support/users/adamrice/)
 * (@adamrice)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/bug-in-tag-clouds/)
 * I’m trying to hack around with WP 2.3 to add support for its tags to my theme(
   I previously used UTW). I want a dropdown menu of all tags, sorted alphabetically.
 * It seems that I should be able to use wp_tag_cloud(‘format=array’) to build on,
   but this **echos** the array, it does not **return** it, making it impossible
   to manipulate, or even display properly.
 * I’ve been doing some messing around with a tweaked version of this function, 
   but have not succeeded in returning a usable array.
 * thanks in advance for any advice.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [adamrice](https://wordpress.org/support/users/adamrice/)
 * (@adamrice)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/bug-in-tag-clouds/#post-637275)
 * bump
 *  [alains](https://wordpress.org/support/users/alains/)
 * (@alains)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/bug-in-tag-clouds/#post-637277)
 * I’ve tried also format=array trying to help you out with the problem …it is correct:
   It just returns “array” text not the tags.
 *  [eikep](https://wordpress.org/support/users/eikep/)
 * (@eikep)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/bug-in-tag-clouds/#post-637352)
 * This seems to be still relevant, so here is the solution:
 * in wp-includes/category-template.php the function wp_tag_cloud echos the return
   value, which makes sense if it’s a HTML string but not if it’s an array.
 * So if you replace
 *     ```
       if ( is_wp_error( $return ) )
       		return false;
       	else
       		echo apply_filters( 'wp_tag_cloud', $return, $args );
       ```
   
 * with
 *     ```
       if ( is_wp_error( $return ) )
       		return false;
       	else if (is_array($return)) {
       	 return $return;
       	} else {
       		echo apply_filters( 'wp_tag_cloud', $return, $args );
       	}
       }
       ```
   
 * (line 234ff) to check if the return value is an array then the array-option works.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 4 months ago](https://wordpress.org/support/topic/bug-in-tag-clouds/#post-637353)
 * Known issue:
    [http://trac.wordpress.org/ticket/5155](http://trac.wordpress.org/ticket/5155)
 * A patch is in that ticket to fix the problem. Hopefully it’ll make it into 2.5.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Bug in tag clouds?’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [tag](https://wordpress.org/support/topic-tag/tag/)
 * [tags](https://wordpress.org/support/topic-tag/tags/)

 * 4 replies
 * 4 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [18 years, 4 months ago](https://wordpress.org/support/topic/bug-in-tag-clouds/#post-637353)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
