Filter hook 'tag_cloud_sort'

in WP Core File wp-includes/category-template.php at line 900

View Source

tag_cloud_sort

Filter Hook
Description
Filters how the items in a tag cloud are sorted.

Hook Information

File Location wp-includes/category-template.php View on GitHub
Hook Type Filter
Line Number 900

Hook Parameters

Type Name Description
WP_Term[] $tags Ordered array of terms.
array $args An array of tag cloud arguments.

Usage Examples

Basic Usage
<?php
// Hook into tag_cloud_sort
add_filter('tag_cloud_sort', 'my_custom_filter', 10, 2);

function my_custom_filter($tags, $args) {
    // Your custom filtering logic here
    return $tags;
}

Source Code Context

wp-includes/category-template.php:900 - How this hook is used in WordPress core
<?php
 895  	 * @since 2.8.0
 896  	 *
 897  	 * @param WP_Term[] $tags Ordered array of terms.
 898  	 * @param array     $args An array of tag cloud arguments.
 899  	 */
 900  	$tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args );
 901  	if ( empty( $tags_sorted ) ) {
 902  		return $return;
 903  	}
 904  
 905  	if ( $tags_sorted !== $tags ) {

PHP Documentation

<?php
/**
	 * Filters how the items in a tag cloud are sorted.
	 *
	 * @since 2.8.0
	 *
	 * @param WP_Term[] $tags Ordered array of terms.
	 * @param array     $args An array of tag cloud arguments.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/category-template.php
Related Hooks

Related hooks will be displayed here in future updates.