diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index 459876f509..9f4e1ac74a 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -808,24 +808,46 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
$font_spread = 1;
$font_step = $font_spread / $spread;
- $a = array();
-
+ // Assemble the data that will be used to generate the tag cloud markup.
+ $tags_data = array();
foreach ( $tags as $key => $tag ) {
+ $tag_id = isset( $tag->id ) ? $tag->id : $key;
+
$count = $counts[ $key ];
$real_count = $real_counts[ $key ];
- $tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#';
- $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key;
- $tag_name = $tags[ $key ]->name;
if ( $translate_nooped_plural ) {
- $title_attribute = sprintf( translate_nooped_plural( $translate_nooped_plural, $real_count ), number_format_i18n( $real_count ) );
+ $title = sprintf( translate_nooped_plural( $translate_nooped_plural, $real_count ), number_format_i18n( $real_count ) );
} else {
- $title_attribute = call_user_func( $args['topic_count_text_callback'], $real_count, $tag, $args );
+ $title = call_user_func( $args['topic_count_text_callback'], $real_count, $tag, $args );
}
- $a[] = "$tag_name";
+ $tags_data[] = array(
+ 'id' => $tag_id,
+ 'url' => '#' != $tag->link ? $tag->link : '#',
+ 'name' => $tag->name,
+ 'title' => $title,
+ 'slug' => $tag->slug,
+ 'real_count' => $real_count,
+ 'class' => 'tag-link-' . $tag_id,
+ 'font_size' => $args['smallest'] + ( $count - $min_count ) * $font_step,
+ );
+ }
+
+ /**
+ * Filter the data used to generate the tag cloud.
+ *
+ * @since 4.3.0
+ *
+ * @param array $tags_data An array of term data for term used to generate the tag cloud.
+ */
+ $tags_data = apply_filters( 'wp_generate_tag_cloud_data', $tags_data );
+
+ $a = array();
+
+ // generate the output links array
+ foreach ( $tags_data as $key => $tag_data ) {
+ $a[] = "" . esc_html( $tag_data['name'] ) . "";
}
switch ( $args['format'] ) {
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 8fa5aca5cd..b322944b3c 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
-$wp_version = '4.3-alpha-32995';
+$wp_version = '4.3-alpha-32996';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.