钩子文档

tag_cloud_sort

💡 云策文档标注

概述

tag_cloud_sort 是一个 WordPress 过滤器,用于控制标签云中项目的排序方式。它允许开发者通过自定义函数修改标签数组的顺序,基于参数如标签名称、计数等。

关键要点

  • 过滤器名称:tag_cloud_sort
  • 参数:$tags(WP_Term[] 有序数组)和 $args(标签云参数数组)
  • 应用位置:在 wp_generate_tag_cloud() 函数中调用,用于生成标签云
  • 引入版本:WordPress 2.8.0

代码示例

$tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args );

📄 原文内容

Filters how the items in a tag cloud are sorted.

Parameters

$tagsWP_Term[]
Ordered array of terms.
$argsarray
An array of tag cloud arguments.

Source

$tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args );

Changelog

Version Description
2.8.0 Introduced.