钩子文档

wp_list_categories

💡 云策文档标注

概述

wp_list_categories 是一个用于过滤分类法列表 HTML 输出的 Hook。它允许开发者在输出分类列表时修改或增强 HTML 内容。

关键要点

  • Hook 名称:wp_list_categories
  • 参数:$output(HTML 输出字符串)和 $args(分类列表参数数组或字符串)
  • 用途:过滤 wp_list_categories() 函数生成的 HTML 输出
  • 相关函数:wp_list_categories(),位于 wp-includes/category-template.php
  • 版本历史:从 WordPress 2.1.0 开始引入

代码示例

$html = apply_filters( 'wp_list_categories', $output, $args );

📄 原文内容

Filters the HTML output of a taxonomy list.

Parameters

$outputstring
HTML output.
$argsarray|string
An array or query string of taxonomy-listing arguments. See wp_list_categories() for information on accepted arguments.

More Arguments from wp_list_categories( … $args )

Array or string of arguments. See WP_Term_Query::__construct() for information on accepted arguments.

Source

$html = apply_filters( 'wp_list_categories', $output, $args );

Changelog

Version Description
2.1.0 Introduced.